Problem Description
The TIA Selection Tool (TST) version 2020.10.0.26446 raises the following user-facing dialog when a CAx AML (AutomationML) export is re-imported into an existing selection configuration under TIA Portal V16 Update 2:
Error opening AML file
The selected AML file could not be loaded
The dialog appears immediately after the file selection is committed, the import pipeline never produces an .aml object model in memory, and the device list in the Selection Tool is not updated. The error is reproducible on the same workstation with the same project data set, but it is independent of the .aml file size and of the network reachability of the TIA Portal installation (see log line "Ping test on intranet failed").
The reproduction sequence is:
- Open the TIA Selection Tool from a TIA Portal V16 Upd2 project that already contains configured devices.
- From the TIA Portal side, perform a CAx export to AML using the Openness / CAx interface.
- In the TST, choose Import and select the freshly exported
.amlfile. - Observe the dialog "Error opening AML file - The selected AML file could not be loaded".
Affected versions confirmed in the field:
| Component | Version | Build | Status |
|---|---|---|---|
| TIA Selection Tool | 2020.10 | 0.26446 | Reproduces |
| TIA Portal | V16 Update 2 | — | Reproduces |
| TIA Portal Openness API | V16 | — | Calls AML export |
| Microsoft .NET Framework | 4.8 | — | Hosts mscorlib throw site |
Root Cause Analysis
The TST writes a structured log under %ProgramData%\Siemens\Automation\SelectionTool\Logging\ (or the equivalent path returned by Environment.SpecialFolder.CommonApplicationData). For the failure described above, the most recent entries in SelectionTool.log show:
[2020-10-16 10:15:53] Information StateChanged (Application) to ModuleInDialogSelectedState: TiaPortalOpenness
[2020-10-16 10:15:53] Information Ping test on intranet failed. This exception is valid and permitted.
[2020-10-16 10:16:05] Error Message: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Source: mscorlib
StackTrace: at System.ThrowHelper.ThrowArgumentOutOfRangeException(...)
at Grollmus.Business.SelectionTool.Helper.MlfbHelper.SortByArticleNumberUpdates(...)
at Grollmus.Business.SelectionTool.Helper.MlfbHelper.GetPossibleMlfbs(...)
at Grollmus.Tst.Program.TiaPortalOpenness.ImportConfigurator.ViewModels.MlfbConvertItemViewModel.FindComparableMlfbs()
at Grollmus.Tst.Program.TiaPortalOpenness.ImportConfigurator.ViewModels.MlfbConvertWrapperViewModel.CreateSubViewModels(...)
at Grollmus.Tst.Program.TiaPortalOpenness.ImportConfigurator.ViewModels.MlfbConvertWrapperViewModel.Init()
at Grollmus.Tst.Program.TiaPortalOpenness.ImportConfigurator.ViewModels.MlfbConvertWrapperViewModel.Refresh()
at Grollmus.Tst.Program.TiaPortalOpenness.ImportConfigurator.ViewModels.MlfbConvertPageViewModel.Init()
at Grollmus.Tst.Program.TiaPortalOpenness.ImportConfigurator.ViewModels.MlfbConvertPageViewModel.Refresh()
at Grollmus.Base.UserSelection.Engine.ViewModels.UserSelectionConfiguratorMainViewModel.Refresh(...)
at Grollmus.Tst.Program.TiaPortalOpenness.ImportConfigurator.ViewModels.ImportConfiguratorMainViewModel.Refresh()
at Grollmus.Tst.Program.TiaPortalOpenness.ViewModels.Import.ImportViewModel.set_SuccessfullyLoaded(Boolean value)
at Grollmus.Tst.Program.TiaPortalOpenness.TiaPortalOpennessModule.<LoadImportProjectAsync>d__29.MoveNext()
The throw site is System.ThrowHelper.ThrowArgumentOutOfRangeException, a standard .NET Framework exception in mscorlib.dll. The relevant stack frame for engineering triage is the first non-framework method:
Grollmus.Business.SelectionTool.Helper.MlfbHelper.SortByArticleNumberUpdates(
String oldArticleNumber, List`1 allArticleNumbers)
The MLFB (Maschinenlesbare Fabrikatebezeichnung, machine-readable product designation) helper iterates over the article-number collection that was read from the imported .aml file. When the AML contains a device whose oldArticleNumber resolves to a string that the helper tries to look up in allArticleNumbers, the index that is produced is either negative or greater than or equal to the count of the list. The helper then forwards the exception up the call chain to MlfbConvertItemViewModel.FindComparableMlfbs(), which propagates it into the ImportViewModel.set_SuccessfullyLoaded(Boolean value) setter, the very last frame before the property change is dispatched. Because the import pipeline sets SuccessfullyLoaded = false in the catch path, the user-facing dialog "The selected AML file could not be loaded" is raised by the view-model that subscribes to that property.
Three contributing factors are visible in the stack:
-
Empty or null article-number segment in the AML. The CAx exporter emits a role class with a flat list of MLFB strings. If the list element is empty (length 0), the index arithmetic in
SortByArticleNumberUpdatesunderflows and throws. -
Article-number order mismatch between TST catalog and TIA Portal catalog. The TST keeps its own offline MLFB catalog. A device that exists in the TIA Portal V16 Upd2 catalog but is not (yet) present in the TST catalog at the article-number level will be passed to the helper as
oldArticleNumberwith a list that does not contain it. The first missing lookup throws. -
Uninitialized
allArticleNumberslist when the Openness API returns a substitute without a primary MLFB. The Openness call siteLoadImportProjectAsyncawaits the substitute collection from the TIA Portal process. If a substitute row has no MLFB, the wrapper passes an empty list toCreateSubViewModels. The wrapper then iterates and callsFindComparableMlfbs(), which dereferences index 0 against an empty list.
Grollmus.Tst.Base.Net when the optional intranet reachability check times out. The TST marks this exception as "valid and permitted" and continues. It is not the cause of the AML import failure and can be ignored during triage.Logging Locations and Diagnostic Capture
Before any remediation, capture the full log set so Siemens Technical Support can correlate the TST view-model exception with the Openness API call. The TST writes a rolling set of files; keep them all.
| Log | Path | Retention |
|---|---|---|
SelectionTool.log |
%ProgramData%\Siemens\Automation\SelectionTool\Logging\ |
Rolling, daily |
PCT.log |
%ProgramData%\Siemens\Automation\PCT\Logging\ |
Rolling |
TIA Portal Openness log |
%LOCALAPPDATA%\Siemens\AutomationLog\ |
Per session |
Windows Event Log |
Application log, source .NET Runtime
|
OS-managed |
The PCT (Product Configuration Tool) log is the most useful for AML/IO-Link issues. Per the TIA Portal Openness API documentation for AML import/export with IO-Link, "If there are any issues with importing PCT relevant configuration, issue details should be logged as appropriate error/warning in PCT.log file." Verify that PCT.log does not contain a related warning about a missing IO-Link port or an unsupported substitution.
Solution Path A - Apply the Catalog Update and Retry the Import
The SortByArticleNumberUpdates helper depends on a current offline catalog. The cleanest first-line remedy is to ensure the catalog is at the same level as the TIA Portal installation and re-export the AML file from the TIA Portal side before re-attempting the import.
- Close the TIA Selection Tool and TIA Portal.
- Start the TIA Selection Tool standalone (Start menu → Siemens Automation → TIA Selection Tool).
- Open Help → Update catalogs and force a complete catalog update over the internet. The update window shows the catalog level (for example, TIA Selection Tool 2020.10 - Catalog 2020-10-15).
- Close the TST.
- Start TIA Portal V16 Upd2, open the project, and re-export the CAx data to AML. This regenerates the role classes and the MLFB references against the current TIA Portal catalog.
- Start the TST from inside the TIA Portal project again and import the freshly written
.amlfile.
If the import still raises ArgumentOutOfRangeException, the missing article number is not in the catalog; proceed to Path B.
Solution Path B - Isolate the Offending Article Number
The exception is thrown for the first article number that the helper cannot resolve. Bisecting the AML content against a minimal TST project makes the offending row visible without recompiling the helper.
- Copy the
.amlfile to a working directory and open it in any XML editor. The file follows the AutomationML 2.0 schema; the article numbers are stored under<InternalElement>role classes with a<Attribute Name="ArticleNumber" />element. - Identify every distinct MLFB string in the file and write them, one per line, to a text file
mlfbs.txt. - Open the TST standalone and build a new selection configuration that contains only the first MLFB. Trigger the same import path that the Openness API uses (TST menu File → Import → AML).
- If the import succeeds, append the next MLFB and re-test. The first MLFB that reproduces the dialog is the one whose catalog row is missing from the TST.
When the offending MLFB has been identified, check the Siemens Industry Online Support catalog for a successor (a "follow-up" article number). The TST 2020.10 release notes document the substitution logic; the helper attempts to sort and pick a successor, but the algorithm only works when the successor exists in allArticleNumbers.
Solution Path C - Pre-flight with the TIA Portal Openness API
For repeated imports in a CI/CD or engineering pipeline, the TIA Portal Openness API exposes a TiaPortalOpennessModule.LoadImportProjectAsync surface that the TST view-model itself calls. Pre-validating the AML through Openness before feeding it to the TST reduces the failure rate and produces a more informative error.
The following C# snippet illustrates a pre-flight check that wraps the Openness import call and returns a structured failure code that mirrors the TST view-model property SuccessfullyLoaded:
using Siemens.Engineering;
using Siemens.Engineering.HW;
using System;
using System.IO;
using System.Threading.Tasks;
public static class TstAmlPreflight
{
public static async Task<bool> ValidateAmlAsync(string tiaProjectPath, string amlFilePath)
{
using (var portal = new TiaPortalInstance(TiaPortalMode.WithUserInterface))
{
var project = portal.Portal.OpenProject(tiaProjectPath);
var openness = project.GetService<OpennessService>();
try
{
// The Openness service exposes AML import via ImportConfiguratorMainViewModel.
// In TST 2020.10 the underlying call is asynchronous and may surface
// ArgumentOutOfRangeException through the SuccessfullyLoaded property.
var result = await openness.LoadImportProjectAsync(amlFilePath);
return result.SuccessfullyLoaded;
}
catch (ArgumentOutOfRangeException ex)
{
// TST log uses the same exception type. Surface the failing index for triage.
File.AppendAllText(
Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
"Siemens\Automation\SelectionTool\Logging\Preflight.log"),
$"[{DateTime.UtcNow:O}] ARG_OOR param={ex.ParamName} message={ex.Message}\n");
return false;
}
}
}
}
Run the pre-flight before opening the TST UI. A false return value indicates that the AML cannot be safely imported into the current catalog; remediate the missing MLFB before retrying.
Solution Path D - Handle Substitute-List Conflicts in Mixed-Vendor Projects
When the project combines Siemens and third-party devices (for example, Schneider Electric TeSys island modules with a PROFINET/PROFIBUS interface configured in TIA Portal), the CAx export emits role classes for both vendors. The TST catalog contains Siemens MLFBs only, so the non-Siemens entries fall into the empty-substitute branch of MlfbConvertWrapperViewModel.CreateSubViewModels. Per the TeSys island PROFINET/PROFIBUS quick-start and library guide for TIA Portal, "If you are importing AML files in a project that has existing devices, the TIA Portal will issue a conflict message (such as the message shown below) before [the import proceeds]." When that conflict message is suppressed (for example, by an automation script that auto-accepts dialogs) the TST still tries to wrap the non-Siemens role class and the helper throws.
Remediation for mixed-vendor projects:
- Before exporting the AML, remove the third-party device role classes from the CAx export scope, or export them to a separate AML file.
- Import the Siemens-only AML into the TST first.
- Import the third-party AML with a vendor-aware configurator (for TeSys island, the Schneider Electric TeSys island Configurator).
Solution Path E - Escalate to Siemens Industry Online Support
The TST view-model code is signed by Grollmus GmbH and shipped as a Siemens-branded product. The exception is in a non-public API (Grollmus.Business.SelectionTool.Helper.MlfbHelper) that is not patchable from the field. The supported escalation is a support request.
- Open the Siemens Industry Online Support request form at support.industry.siemens.com.
- Attach the full
%ProgramData%\Siemens\Automation\SelectionTool\Logging\directory, the fullPCT.log, the TIA Portal project (zipped, password-protected if it contains customer data), and the.amlfile that reproduces the failure. - Reference the throw site and stack:
MlfbHelper.SortByArticleNumberUpdates→MlfbHelper.GetPossibleMlfbs→MlfbConvertItemViewModel.FindComparableMlfbs. - Note the TST build (
2020.10.0.26446) and the TIA Portal version (V16 Upd2). Siemens Engineering uses these to map the failure to a TST hotfix branch.
Siemens typically replies with one of the following:
- A TST hotfix build that re-validates
allArticleNumbersagainst the catalog before indexing. - An updated TIA Portal Service Pack that supplies a more robust CAx export.
- A request for additional project data and a remote session to capture a process dump.
Verification
After applying any of the solution paths, confirm the import works end to end:
- Start TIA Portal V16 Upd2 and open the project.
- Start the TST from inside the project.
- Trigger the same import that previously failed: File → Import → AML and select the
.amlfile. - Expected behavior: the TST shows the device list populated from the AML within 5 to 15 seconds (catalog lookup dominates the time), no dialog is raised, and the log contains an
Informationline forStateChanged (Application) to ModuleInDialogSelectedState: TiaPortalOpennessfollowed by anInformationline for the successful import. - Expected log signature on success:
[YYYY-MM-DD HH:MM:SS] Information StateChanged (Application) to ModuleInDialogSelectedState: TiaPortalOpenness
[YYYY-MM-DD HH:MM:SS] Information Import finished successfully. DeviceCount=N
If the dialog still appears, repeat the log capture and re-run the support request with the new log set.
Troubleshooting Matrix
| Symptom | Log evidence | Likely cause | Remediation |
|---|---|---|---|
| "Error opening AML file" dialog |
ArgumentOutOfRangeException in MlfbHelper.SortByArticleNumberUpdates
|
Empty or missing MLFB in AML | Path B: bisect the AML to find the offending MLFB |
| Same dialog, no stack in log | No Error line, only Ping test on intranet failed
|
Network is offline and the catalog updater is blocked | Path A: run the catalog updater with internet access |
| Dialog only with mixed-vendor projects | PCT log shows substitute with no MLFB | Third-party role class without MLFB | Path D: separate Siemens and third-party AML files |
| Dialog only after TIA Portal upgrade | Log shows a newer TST build entry than the project | Catalog drift between TIA Portal and TST | Path A: align catalogs, re-export AML |
| Dialog only on a specific workstation | Log shows mscorlib exception with the same stack |
Corrupt local TST cache | Delete %LocalAppData%\Siemens\Automation\SelectionTool\Cache\ and retry |
Preventive Measures
Three engineering practices keep the AML import path stable across project handovers:
- Pin TST and TIA Portal catalog dates. Document the catalog level (for example, "TST 2020.10 - Catalog 2020-10-15") in the project README. The TST Help → About dialog reports the build; the catalog level is reported in the Update catalogs dialog.
-
Run the pre-flight check (Path C) in CI. A small C# console that calls the Openness API
LoadImportProjectAsyncand reportsSuccessfullyLoadedis enough to fail the build when an AML is not importable. - Keep the TIA Portal installation on the latest service pack for the major version. The exception is reproducible on V16 Upd2; Siemens typically bundles catalog-fixes in subsequent updates. Always read the TIA Portal update release notes for "TIA Selection Tool" entries before planning an upgrade.
Related Standards and Documentation
- TIA Portal Openness API: Export/Import AML file with IO-Link - Documents the PCT.log capture and AML/IO-Link import semantics.
- TeSys island PROFINET/PROFIBUS in TIA Portal - Quick Start and Library Guide - Documents the conflict behavior when AML files are imported into a project that already has devices.
- Siemens Industry Online Support - Create a support request - Official channel for hotfix requests and engineering escalations.
What does the "Index was out of range" error in SelectionTool.log mean?
The exception is raised by MlfbHelper.SortByArticleNumberUpdates when the AML file contains a device whose MLFB is empty, missing, or not in the TST catalog. The helper tries to look up the MLFB in allArticleNumbers and the resulting index is out of range. Fix by updating the TST catalog (Path A) or by isolating and correcting the offending MLFB (Path B).
Can the AML import error be fixed without a Siemens hotfix?
Yes, in most cases. The throw site is data-driven, not a logic bug. Update the offline catalog with Help → Update catalogs, re-export the AML from TIA Portal, and the import will succeed. If the project contains third-party devices without MLFB, split the AML by vendor (Path D).
Which TIA Selection Tool version fixes the ArgumentOutOfRangeException?
Siemens does not publish a public list of bug fixes for the TST view-model code. The supported path is to open a support request at support.industry.siemens.com with the log files and the .aml that reproduces the failure; Siemens Engineering will map the issue to a TST hotfix branch.
Why does the log show "Ping test on intranet failed" if the import error is unrelated?
That line is emitted by the TST base library when an optional intranet reachability check times out. The exception type is caught and the pipeline continues. The line is informational and not the cause of the AML import failure. It can be safely ignored for this specific error.
Is the AML import error specific to TIA Portal V16 Update 2?
The reproduction reported here uses TST 2020.10.0.26446 and TIA Portal V16 Upd2. The same stack and the same ArgumentOutOfRangeException source can appear on later versions when the catalog is out of sync with the TIA Portal. The remediation steps (update catalog, isolate MLFB, escalate to support) apply to any version that ships the same Grollmus.Business.SelectionTool.Helper.MlfbHelper assembly.