Skip to content

Noser - #13

Merged
bqstony merged 16 commits into
masterfrom
noser
Jun 4, 2026
Merged

Noser#13
bqstony merged 16 commits into
masterfrom
noser

Conversation

@bqstony

@bqstony bqstony commented Nov 26, 2025

Copy link
Copy Markdown
Member

This pull request introduces a new feature for writing structs with CommandInputBuilder and PrimitiveCommandArgumentHandler, fixes a bug with double writes, and upgrades several dependencies. Additionally, all test projects now use AwesomeAssertions instead of FluentAssertions, and the Beckhoff TwinCAT.Ads package is updated across projects. Below are the most important changes grouped by theme.

Features and Bugfixes

  • Added support for writing structs (including recursive structs) to the PLC using CommandInputBuilder and PrimitiveCommandArgumentHandler. Struct fields must be flagged with {attribute 'PlcCommandInput'} and be of type CommandInputBuilder in C#.
  • Fixed an issue where PrimitiveCommandArgumentHandler would perform a double write in WriteInputData.

Dependency and Version Upgrades

  • Updated the Beckhoff.TwinCAT.Ads package from version 6.1.332 to 6.2.521 in both Mbc.Ads.Utils and Mbc.Pcs.Net.Alarm projects. [1] [2]
  • Bumped the version numbers for Mbc.Ads.Utils and Mbc.Pcs.Net.Alarm projects from 5.0.0.0 to 5.1.0.0. [1] [2]

Test Suite Updates

Minor Code Improvements

  • Updated usages of StringMarshaler.UTF16 to StringMarshaler.UTF16.Encoding in test helpers for improved clarity and correctness. [1] [2]

Copilot AI review requested due to automatic review settings November 26, 2025 19:05
@bqstony bqstony self-assigned this Nov 26, 2025
@bqstony

bqstony commented Nov 26, 2025

Copy link
Copy Markdown
Member Author

@copilot review the code

Copilot AI commented Nov 26, 2025

Copy link
Copy Markdown
Contributor

@bqstony I've opened a new pull request, #14, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces support for writing structs with CommandInputBuilder and PrimitiveCommandArgumentHandler, fixes a double-write bug, adds auto-reconnect functionality to PlcAdsConnectionService, improves PlcAdsStateReader robustness, upgrades dependencies, and migrates all test projects from FluentAssertions to AwesomeAssertions.

Key Changes:

  • Added recursive struct writing support in PrimitiveCommandArgumentHandler for PLC commands
  • Fixed double write issue in WriteInputData method
  • Implemented auto-reconnect feature with configurable timeout in PlcAdsConnectionService
  • Enhanced PlcAdsStateReader.StopSampling() with safer notification cleanup using TryDeleteDeviceNotification
  • Upgraded Beckhoff.TwinCAT.Ads from 6.1.332 to 6.2.521 and bumped package versions to 5.1.0.0
  • Migrated all test projects to AwesomeAssertions 9.* and updated assertion syntax
  • Updated auto-generated resource files to English and newer tool versions

Reviewed changes

Copilot reviewed 47 out of 49 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
NET/Mbc.Pcs.Net.Command/PrimitiveCommandArgumentHandler.cs Added struct support to WriteInputData, removed duplicate write call, enabled recursive struct handling
NET/Mbc.Pcs.Net/State/PlcAdsStateReader.cs Enhanced StopSampling() with safer notification cleanup and handle validation
NET/Mbc.Pcs.Net/Connection/PlcAdsConnectionService.cs Implemented auto-reconnect feature with cancellation token and configurable retry interval
NET/Mbc.Pcs.Net/Connection/PlcAdsConnectionProvider.cs Updated to use ILoggerFactory instead of ILogger for proper logger instantiation
NET/Mbc.Pcs.Net/Connection/ConnectionResources.Designer.cs Auto-generated file updated from German to English comments
NET/Mbc.Pcs.Net.Command/CommandResources.Designer.cs Auto-generated file updated to version 17.0.0.0
NET/Mbc.Pcs.Net/Mbc.Pcs.Net.csproj Version bumped to 5.1.0.0
NET/Mbc.Pcs.Net.Alarm/Mbc.Pcs.Net.Alarm.csproj Version bumped to 5.1.0.0, Beckhoff.TwinCAT.Ads upgraded to 6.2.521
NET/Mbc.Ads.Utils/Mbc.Ads.Utils.csproj Version bumped to 5.1.0.0, Beckhoff.TwinCAT.Ads upgraded to 6.2.521
NET/Mbc.Pcs.Net.Test/Mbc.Pcs.Net.Test.csproj Replaced FluentAssertions with AwesomeAssertions 9.*
NET/Mbc.Pcs.Net.DataRecorder.Test/Mbc.Pcs.Net.DataRecorder.Test.csproj Replaced FluentAssertions with AwesomeAssertions 9.*
NET/Mbc.Pcs.Net.Command.Test/Mbc.Pcs.Net.Command.Test.csproj Replaced FluentAssertions with AwesomeAssertions 9.*
NET/Mbc.Pcs.Net.Alarm.Test/Mbc.Pcs.Net.Alarm.Test.csproj Replaced FluentAssertions with AwesomeAssertions 9.*
NET/Mbc.Pcs.Net.Alarm.Service.Test/Mbc.Pcs.Net.Alarm.Service.Test.csproj Replaced FluentAssertions with AwesomeAssertions 9.*
NET/Mbc.Ads.Utils.Test/Mbc.Ads.Utils.Test.csproj Replaced FluentAssertions with AwesomeAssertions 9.*
NET/Mbc.Ads.Mapper.Test/Mbc.Ads.Mapper.Test.csproj Replaced FluentAssertions with AwesomeAssertions 9.*
NET/Mbc.Pcs.Net.Command.Test/PlcCommandAsyncTests.cs Updated assertion method from BeLessOrEqualTo to BeLessThanOrEqualTo for AwesomeAssertions compatibility
NET/Mbc.Ads.Mapper.Test/AdsMapperTestFakePlcData.cs Updated StringMarshaler.UTF16 to StringMarshaler.UTF16.Encoding for clarity
NET/Changelog.md Added version 5.0.1 entry documenting struct support and double-write bugfix
Various test files Updated imports from FluentAssertions to AwesomeAssertions
Files not reviewed (2)
  • NET/Mbc.Pcs.Net.Command/CommandResources.Designer.cs: Language not supported
  • NET/Mbc.Pcs.Net/Connection/ConnectionResources.Designer.cs: Language not supported
Comments suppressed due to low confidence (1)

NET/Mbc.Ads.Mapper.Test/AdsMapperTestFakePlcData.cs:261

            public MockMemberCollection(List<IMember> members)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread NET/Mbc.Pcs.Net/Connection/PlcAdsConnectionService.cs Outdated
Comment thread NET/Mbc.Pcs.Net/Connection/PlcAdsConnectionService.cs Outdated
Comment thread NET/Changelog.md Outdated
Comment thread NET/Changelog.md Outdated
Comment thread NET/Mbc.Pcs.Net.Command/PrimitiveCommandArgumentHandler.cs
Comment thread NET/Mbc.Pcs.Net/State/PlcAdsStateReader.cs
private bool _connected;
private IAdsConnection _connection;
private bool _autoReconnectEnabled;
private ILogger _logger = null;

Copilot AI Nov 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The field _logger is initialized to null by default on line 24, but this explicit initialization is unnecessary in C# as reference types are null by default. Consider removing the = null for cleaner code.

Copilot uses AI. Check for mistakes.
Comment thread NET/Mbc.Pcs.Net.Command/PrimitiveCommandArgumentHandler.cs
private readonly PlcAdsConnectionProvider _plcConnection;
private bool _connected;
private IAdsConnection _connection;
private bool _autoReconnectEnabled;

Copilot AI Nov 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Field '_autoReconnectEnabled' can be 'readonly'.

Copilot uses AI. Check for mistakes.
Comment thread NET/Mbc.Pcs.Net/Connection/PlcAdsConnectionService.cs Outdated
- Removed Support for .NET Framework 4.7.1 (But still .NET Standard 2.0.)
- Removed Dependency to Mbc.Hdf5Utils Nuget package. The code is now part of Mbc.Pcs.Net.DataRecorder.
Update cake build to version 6.2 now with dotnet tool
.\build.ps1 -Target Build
.\build.ps1 -Target Test              # x64
.\build.ps1 -Target Test --x86=true  # x64 & x86
.\build.ps1 -Target NugetPublish --apikey=<key>
@bqstony
bqstony merged commit 4f0d15c into master Jun 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants