Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions .github/workflows

This file was deleted.

64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
build:
runs-on: windows-latest

defaults:
run:
shell: pwsh
working-directory: NET

steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
10.0.x

- name: NuGet packages cache
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('NET/**/*.csproj', 'NET/Directory.Build.props', 'NET/.config/dotnet-tools.json') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: Restore .NET local tools (Cake)
run: dotnet tool restore

- name: Run Cake build (Build + Test)
run: .\build.ps1 -Target Test --x86=false

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: testresults
path: |
NET/testresult/**
NET/testresultx86/**
if-no-files-found: ignore

- name: Upload NuGet packages
if: always()
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: |
NET/**/bin/Release/**/*.nupkg
NET/**/bin/Release/**/*.snupkg
if-no-files-found: warn
71 changes: 71 additions & 0 deletions .github/workflows/nugetPublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: NuGet Publish

on:
# Manual trigger from the Actions tab
workflow_dispatch:

# Automatically publish when a version tag is pushed (e.g. Mbc.Pcs.Net/v1.2.3)
push:
tags:
- 'Mbc.Pcs.Net/v*'

permissions:
contents: read

jobs:
publish:
runs-on: windows-latest

environment: nuget-publish # optional: gate with required reviewers in repo settings

defaults:
run:
shell: pwsh
working-directory: NET

steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
10.0.x

- name: NuGet packages cache
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('NET/**/*.csproj', 'NET/Directory.Build.props', 'NET/.config/dotnet-tools.json') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: Restore .NET local tools (Cake)
run: dotnet tool restore

- name: Build, Test and Publish NuGet packages
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: .\build.ps1 -Target NugetPublish --x86=false --apikey="$env:NUGET_API_KEY"

- name: Upload NuGet packages
if: always()
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: |
NET/**/bin/Release/**/*.nupkg
NET/**/bin/Release/**/*.snupkg
if-no-files-found: warn

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: testresults
path: |
NET/testresult/**
NET/testresultx86/**
if-no-files-found: ignore
12 changes: 12 additions & 0 deletions NET/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"cake.tool": {
"version": "6.2.0",
"commands": [
"dotnet-cake"
]
}
}
}
5 changes: 2 additions & 3 deletions NET/AdsMapperCli/AdsMapperCli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<StartupObject>AdsMapperCli.Program</StartupObject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.*" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.*" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.*" />
<PackageReference Include="System.Text.Json" Version="8.*" />
</ItemGroup>

<ItemGroup>
Expand Down
39 changes: 39 additions & 0 deletions NET/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,45 @@ The following types of changes exist:
- **Fixed** for any bug fixes.
- **Security** in case of vulnerabilities.

## 2026 Summer, Version 5.2.0
### Removed
- 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.

### Added
- Support for .NET 10.0.
- Add Automatic recconection behavior in PlcAdsConnectionService

### Changed
- Update to Beckhoff.TwinCAT.Ads version 6.2.521
- Use xUnit v3 for testing insteed of v2.

### Fixed
- fixed deadlock in PlcAdsConnectionService
- fixed handling PlcAdsStateReader when stop is called before start
- Mbc.Pcs.Net.DataRecorder: HDF5Close is not called when the AppDomain is shutting down to avoid stack overflow in the finalizer thread due to HDF5's error handler being called when the library is already tearing down. See the comments in the Dispose methods of H5Group, H5File, H5Id, H5DataSet and H5DataSpace for details.

## 2025 Summer, Version 5.1.0
### Feature
- It is now possible to write Structs with the `CommandInputBuilder` and the `PrimitiveCommandArgumentHandler`. Actually it results in multiple write commands to the PLC. So each struct and it fields will be recursively written to the PLC also in recursive structs. The fields in the struct has to be flagged with the `{attribute 'PlcCommandInput'}`. The Struct values must in c# be of type of `CommandInputBuilder`.
```C#
ICommandInput inputStructValues = CommandInputBuilder.FromDictionary(new Dictionary<string, object>()
{
["StructValue1"] = 123,
["StructValue2"] = 3333,
});

ICommandInput input = CommandInputBuilder.FromDictionary(new Dictionary<string, object>()
{
["value1"] = (byte)123,
["stAbc"] = inputStructValues,
["value2"] = (byte)222,
});
```

### Bugfix
- Remove double write of `PrimitiveCommandArgumentHandler` in WriteInputData

## 2025 Spring, Version 5.0.0
- See PR #8
- All packages are now on Version 5.0.0
Expand Down
5 changes: 4 additions & 1 deletion NET/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,15 @@ limitations under the License.
<CodeAnalysisRuleSet>$(MSBuildProjectDirectory)\..\Build\Mbc.CodeAnalysis.ruleset</CodeAnalysisRuleSet>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisLevel>latest</AnalysisLevel>
<_SkipUpgradeNetAnalyzersNuGetWarning>true</_SkipUpgradeNetAnalyzersNuGetWarning>
</PropertyGroup>
<ItemGroup>
<!-- Mark Analyzers as Private so it will not result in a dependency in the nuget -->
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.*">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.*" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="10.*" >
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion NET/Mbc.Ads.Helper.ReadType/Mbc.Ads.Helper.ReadType.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion NET/Mbc.Ads.Mapper.Test/AdsBinaryAccesorFactoryTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using FakeItEasy;
using FluentAssertions;
using AwesomeAssertions;
using System;
using System.Text;
using TwinCAT.PlcOpen;
Expand Down
3 changes: 1 addition & 2 deletions NET/Mbc.Ads.Mapper.Test/AdsMapperTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
// Licensed under the Apache License, Version 2.0
//-----------------------------------------------------------------------------

using FluentAssertions;
using AwesomeAssertions;
using System;
using System.Diagnostics;
using Xunit;
using Xunit.Abstractions;

namespace Mbc.Ads.Mapper.Test
{
Expand Down
4 changes: 2 additions & 2 deletions NET/Mbc.Ads.Mapper.Test/AdsMapperTestFakePlcData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private IAdsSymbolInfo CreateFakeIAdsSymbolInfo()

fakeMembers.Add(CreateFakeStringMember("sPlcVersion", 82, StringMarshaler.DefaultEncoding, 10, 11));
fakeMembers.Add(CreateFakeStringMember("sUtf7String", 93, StringMarshaler.DefaultEncoding, 6, 7));
fakeMembers.Add(CreateFakeStringMember("wsUnicodeString", 100, StringMarshaler.UTF16, 6, 14));
fakeMembers.Add(CreateFakeStringMember("wsUnicodeString", 100, StringMarshaler.UTF16.Encoding, 6, 14));

return fakeSymbolInfo;
}
Expand Down Expand Up @@ -238,7 +238,7 @@ private byte[] CreateAdsStream()
writer.Write(str2); // offset 93

var str3 = new byte[14];
StringMarshaler.UTF16.GetBytes("ÄÖö@Ü8", 0, 6, str3, 0);
StringMarshaler.UTF16.Encoding.GetBytes("ÄÖö@Ü8", 0, 6, str3, 0);
writer.Write(str3); // offset 100

// Write Motor Object
Expand Down
2 changes: 1 addition & 1 deletion NET/Mbc.Ads.Mapper.Test/AdsSymbolReaderTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using FakeItEasy;
using FluentAssertions;
using AwesomeAssertions;
using TwinCAT.Ads;
using Xunit;

Expand Down
2 changes: 1 addition & 1 deletion NET/Mbc.Ads.Mapper.Test/DataObjectAccessorTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using FluentAssertions;
using AwesomeAssertions;
using System.Linq;
using Xunit;

Expand Down
44 changes: 0 additions & 44 deletions NET/Mbc.Ads.Mapper.Test/MarshallingPerformanceTest.cs

This file was deleted.

Loading
Loading