Skip to content

Settings: PlcTaskName dropdown is empty for Standard PLC Project (v1.18.1) #89

Description

@macenc87

Bug summary

The PlcTaskName dropdown in TwinCAT → Settings is empty even when the PLC project has a properly configured PlcTask linked to a Standard PLC Project. The dropdown does not allow free-text entry either. Clicking OK overwrites the saved value in OC.Assistant.xml with an empty string, breaking subsequent Update Project operations.

Environment

  • OC.Assistant v1.18.1
  • TwinCAT 3.1.4026.22 (TcXaeShell based on Visual Studio 2022)
  • Windows 11
  • OC_TwinCAT_Core v1.3.1, TcUnit v1.3.1
  • .NET Desktop Runtime 10.0.8
  • Single Standard PLC Project named TestPlc with default PlcTask (CycleTime 10 ms, Priority 20)

Reproduction

  1. Create a fresh TwinCAT XAE solution with one Standard PLC Project (TestPlc).
  2. Install OC_Core + TcUnit libraries; reference them in the PLC project.
  3. Build the solution, activate configuration (7-day trial license active, runtime in Config mode).
  4. Close TcXaeShell.
  5. Open the .sln in OC.Assistant via the open button.
  6. TwinCAT → Settings: PlcName dropdown correctly shows TestPlc. PlcTaskName dropdown is empty with no entries to select and does not accept typed input.

Inspection of project state

The .tsproj has the PLC properly bound (AmsPort=851) with a <Context Name="PlcTask"> linking PLC task to system task. The _Boot\TwinCAT RT (x64)\Plc\Port_851.* files exist. Build succeeds with 0 errors / 0 warnings.

Workaround

Manually editing OC.Assistant.xml to add <PlcProjectName>TestPlc</PlcProjectName> and <PlcTaskName>PlcTask</PlcTaskName> under <Twincat><Settings> works — as long as the Settings dialog is never reopened (clicking OK after that wipes the value).

Source code reference

The actual task lookup at generation time uses a direct name-based GetItem call (see OC.Assistant.Twincat/Automation/TaskGenerator.cs around the tcSysManager.GetItem(...) call), so the XML value alone is sufficient. The bug is purely in the Settings UI population of the dropdown.

Suggested fixes

  1. Make the PlcTaskName combo box editable so users can type the name as a fallback.
  2. Populate the dropdown directly from the <Plc><Project><Instance><Contexts><Context><Name> entries in .tsproj, which is reliable across build/activation states.
  3. If the dropdown can't enumerate, preserve the existing XML value rather than clearing it on OK.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions