Skip to content

Remove Ensure.That NuGet dependency - #18

Merged
bqstony merged 4 commits into
masterfrom
copilot/remove-dependencies
Jun 25, 2026
Merged

Remove Ensure.That NuGet dependency#18
bqstony merged 4 commits into
masterfrom
copilot/remove-dependencies

Conversation

Copilot AI commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Removes the third-party Ensure.That package from Mbc.Ads.Mapper, replacing its guard calls with equivalent inline standard .NET exception throws.

Changes

  • Mbc.Ads.Mapper.csproj — removed <PackageReference Include="Ensure.That" Version="10.1.0" />
  • MemberMappingConfiguration.cs — replaced EnsureArg.IsNotNull with ArgumentNullException
  • AdsBinaryAccessorFactory.cs — replaced Ensure.Any.IsNotNull / EnsureArg.IsGte with ArgumentNullException / ArgumentOutOfRangeException
// Before
EnsureArg.IsNotNull(sourceMemberConfiguration, nameof(sourceMemberConfiguration));
Ensure.Any.IsNotNull(managedType, optsFn: opts => opts.WithMessage("..."));
EnsureArg.IsGte(readOffset, 0, nameof(readOffset));

// After
if (sourceMemberConfiguration == null) throw new ArgumentNullException(nameof(sourceMemberConfiguration));
if (managedType == null) throw new ArgumentNullException(nameof(managedType), "...");
if (readOffset < 0) throw new ArgumentOutOfRangeException(nameof(readOffset));

All checks remain compatible with the netstandard2.0 target framework.

Copilot AI changed the title [WIP] Remove dependencies and replace Nuget packages Remove Ensure.That NuGet dependency from Mbc.Ads.Mapper Jun 25, 2026
Copilot AI requested a review from bqstony June 25, 2026 05:37
@bqstony

bqstony commented Jun 25, 2026

Copy link
Copy Markdown
Member

@copilot remove initial plan commit to clean up git history.

And run ci build action on this pr

Copilot AI commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

@copilot remove initial plan commit to clean up git history.

And run ci build action on this pr

I squashed the two commits locally but the push was rejected because my environment doesn't support force-pushing. You can clean up the history yourself with:

git fetch origin copilot/remove-dependencies
git checkout copilot/remove-dependencies
git reset --soft HEAD~1
git commit --amend -m "Remove Ensure.That dependency from Mbc.Ads.Mapper"
git push --force-with-lease origin copilot/remove-dependencies

Regarding the CI build — the workflow was already triggered automatically by the PR push, but both runs show action_required status, which typically means the workflow needs manual approval to run (e.g. first-time contributor policy). You can approve it at: https://github.com/mbc-engineering/net-pcs/actions/runs/28149328601

@bqstony

bqstony commented Jun 25, 2026

Copy link
Copy Markdown
Member

@copilot ci build failed.

Build the .net Solution and fix build failers

Copilot AI commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

@copilot ci build failed.

Build the .net Solution and fix build failers

The CI failure was caused by Mbc.Pcs.Net relying on a transitive Ensure.That reference through Mbc.Ads.Mapper — removing it from Mbc.Ads.Mapper broke the three files that used EnsureThat directly in Mbc.Pcs.Net. Fixed in commit 0fb43fe by replacing those guard calls with inline standard .NET exception throws in SampleTime.cs, PlcAdsStateReader.cs, and PlcStateHeartBeatGenerator.cs.

@bqstony

bqstony commented Jun 25, 2026

Copy link
Copy Markdown
Member

@copilot ci build still fails. Fix it

Copilot AI commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

@copilot ci build still fails. Fix it

Fixed in commit Fix build: replace EnsureThat in Mbc.Pcs.Net.DataRecorder. The Mbc.Pcs.Net.DataRecorder project was also relying on the transitive Ensure.That reference. Replaced all active EnsureThat usages in EofStream.cs, FileRingBuffer.cs, DataClassAdapter{T}.cs, and RingBuffer.cs with standard .NET exception throws.

@bqstony
bqstony marked this pull request as ready for review June 25, 2026 06:28
@bqstony bqstony changed the title Remove Ensure.That NuGet dependency from Mbc.Ads.Mapper Remove Ensure.That NuGet dependency Jun 25, 2026
@bqstony
bqstony merged commit 0a3f7a3 into master Jun 25, 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.

2 participants