.NET: SDK Patch Bump (10.0.200) - Address false positive trigger of IL2026/IL3050 diagnostics in hosting projects (#4586)

* Suppress IL2026/IL3050 with targeted pragmas on affected methods

Add #pragma warning disable/restore for IL2026 and IL3050 only around
the specific methods where dotnet format incorrectly adds
[RequiresUnreferencedCode] and [RequiresDynamicCode] attributes despite
proper interceptors configuration in the csproj.

See https://github.com/dotnet/sdk/issues/51136

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Upgrade to .NET SDK 10.0.200 and remove IL2026/IL3050 workarounds

Bump global.json to SDK 10.0.200 which fixes the dotnet format bug
that incorrectly added [RequiresUnreferencedCode] and
[RequiresDynamicCode] attributes (https://github.com/dotnet/sdk/issues/51136).

Remove all #pragma warning disable IL2026/IL3050 workarounds from
source files and the --exclude-diagnostics flag from the CI format
workflow.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Roger Barreto
2026-03-11 10:47:08 +00:00
committed by GitHub
Unverified
parent d3f0c33180
commit 60d5093421
2 changed files with 2 additions and 3 deletions
+1 -2
View File
@@ -86,11 +86,10 @@ jobs:
run: docker pull mcr.microsoft.com/dotnet/sdk:${{ matrix.dotnet }}
# This step will run dotnet format on each of the unique csproj files and fail if any changes are made
# exclude-diagnostics should be removed after fixes for IL2026 and IL3050 are out: https://github.com/dotnet/sdk/issues/51136
- name: Run dotnet format
if: steps.find-csproj.outputs.csproj_files != ''
run: |
for csproj in ${{ steps.find-csproj.outputs.csproj_files }}; do
echo "Running dotnet format on $csproj"
docker run --rm -v $(pwd):/app -w /app mcr.microsoft.com/dotnet/sdk:${{ matrix.dotnet }} /bin/sh -c "dotnet format $csproj --verify-no-changes --verbosity diagnostic --exclude-diagnostics IL2026 IL3050"
docker run --rm -v $(pwd):/app -w /app mcr.microsoft.com/dotnet/sdk:${{ matrix.dotnet }} /bin/sh -c "dotnet format $csproj --verify-no-changes --verbosity diagnostic"
done
+1 -1
View File
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "10.0.100",
"version": "10.0.200",
"rollForward": "minor",
"allowPrerelease": false
},