Skip to content

fix: netstandard2.0 compat and add Release build to CI#178

Merged
elantiguamsft merged 1 commit intomainfrom
fix/netstandard2-compat-and-release-build
Mar 18, 2026
Merged

fix: netstandard2.0 compat and add Release build to CI#178
elantiguamsft merged 1 commit intomainfrom
fix/netstandard2-compat-and-release-build

Conversation

@JeromySt
Copy link
Member

@JeromySt JeromySt commented Mar 17, 2026

Problem

MstServiceException.cs uses string.Contains(string, StringComparison) which is not available in netstandard2.0. The .NET 10 SDK silently polyfills this API, so GitHub CI and local builds pass, but the internal ADO pipeline (using .NET 8 SDK) fails on the Release build.

Additionally, GitHub CI only builds Debug configuration, so Release-only issues are not caught before merge.

Changes

  1. MstServiceException.cs - replaced Contains(..., StringComparison) with IndexOf(..., StringComparison) >= 0 which is available across all netstandard2.0 SDK versions.
  2. dotnet.yml - added a Build Release step after tests so both configurations are validated in PR CI.

Why Debug passed

The .NET 10 SDK (used locally and in GitHub CI) provides implicit polyfills for newer string APIs when targeting netstandard2.0. The .NET 8 SDK used by the ADO pipeline does not, exposing the incompatibility only in that environment.

elantiguamsft
elantiguamsft previously approved these changes Mar 17, 2026
@JeromySt JeromySt force-pushed the fix/netstandard2-compat-and-release-build branch from 1f1fb45 to 1f19744 Compare March 17, 2026 15:27
- Replace string.Contains(string, StringComparison) with IndexOf in
  MstServiceException.cs. The 2-arg Contains overload is not available
  in netstandard2.0; .NET 10 SDK polyfills it silently, but .NET 8 SDK
  (used by the internal ADO pipeline) does not.
- Add a Release build step to the GitHub CI workflow so configuration-
  specific issues are caught before merge.
- Remove global RuntimeIdentifier=osx-arm64 from Directory.Build.props.
  It conflicted with CoseSignTool.csproj's RuntimeIdentifiers on .NET
  SDK 10.x (NETSDK1032). TestingPlatformArchitecture=arm64 is
  sufficient for test runner support on macOS ARM64.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JeromySt JeromySt force-pushed the fix/netstandard2-compat-and-release-build branch from 1f19744 to 82c3a9f Compare March 17, 2026 15:41
@elantiguamsft elantiguamsft merged commit 187a2e8 into main Mar 18, 2026
11 checks passed
@elantiguamsft elantiguamsft deleted the fix/netstandard2-compat-and-release-build branch March 18, 2026 16:53
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