Repository navigation
Description
Sentry.props sets _SentryIsNet8OrGreater and _SentryIsNet10OrGreater only when TargetFramework has a value. NuGet imports Sentry.props before the project body, and a project with a single <TargetFramework> sets it later, in that body. Both flags stay empty unless -f passes TargetFramework as a global property. dotnet new console creates a project like that, and most people build and publish it without -f.
Two parts of Sentry.targets read these flags:
- The Native AOT upload settings at
Sentry.targets:173check_SentryIsNet8OrGreaterin aPropertyGroupcondition.Sentry.Native.targetsrecomputes that flag, butSentry.targetsimports it at the end, after MSBuild has evaluated the condition. The build falls back to the managed upload, which runs afterBuildand uploads frombin/instead ofpublish/. SetAndroidNdkPreloadatSentry.targets:298checks_SentryIsNet10OrGreater, and nothing recomputes that flag. Android apps on CoreCLR don't get theio.sentry.ndk.preloadmetadata that fix: prevent redundant native exceptions on Android/CoreCLR #5127 added to fix the duplicate native crash reports from Prevent Native/Cocoa SDKs from capturing errors that also get captured by .NET #3954.
Native AOT
The test app is an osx-arm64 console app that targets net10.0 and sets PublishAot, SentryUploadSymbols, SentryCreateRelease and SentrySetCommits. A fake sentry-cli logged what dotnet publish -c Release asked it to upload with main's targets:
| SDK | Without -f |
With -f net10.0, or with the fix below |
|---|---|---|
| .NET 10.0.401 | -t pdb -t portablepdb bin/Release/net10.0/osx-arm64/ |
-t pdb -t dsym -t elf bin/Release/net10.0/osx-arm64/publish/ |
| .NET 11 RC 2 | no upload | -t pdb -t dsym -t elf bin/Release/net10.0/osx-arm64/publish/ |
releases new and set-commits ran in every case.
On the .NET 10 SDK, the native debug files never reach Sentry. Those are the dSYM on macOS, the .dbg file on Linux and the native PDB on Windows. Without them, Sentry can't symbolicate native crashes from these apps. Sentry 6.12.1 from nuget.org shows the same result.
On the .NET 11 SDK, the managed upload doesn't run at all, because that SDK's Native AOT publish skips Build, as described in dotnet/sdk#54515. #5731 hooked CheckSentryCLI and the release targets onto the new publish path, but the managed upload still waits for Build.
Android
For a net10.0-android app with UseMonoRuntime=false and Sentry 6.12.1, dotnet msbuild -t:GetAssemblyAttributes -getItem:AssemblyAttribute lists no io.sentry.ndk.preload metadata. With -p:TargetFramework=net10.0-android, it lists it. The check covers the build output only, not a run on a device.
Why CI doesn't catch it
The integration tests always pass --framework, in integration-test/common.ps1:130 and integration-test/android.Tests.ps1:51.
Workaround
Build and publish with -f <tfm>.
Fix
Also compute the flags near the top of Sentry.targets. NuGet imports that file after the project body, so TargetFramework has its value by then:
<PropertyGroup Condition="'$(TargetFramework)' != ''">
<_SentryTargetFrameworkVersion>$([MSBuild]::GetTargetFrameworkVersion($(TargetFramework)))</_SentryTargetFrameworkVersion>
<_SentryIsNet8OrGreater>$([MSBuild]::VersionGreaterThanOrEquals($(_SentryTargetFrameworkVersion), 8.0))</_SentryIsNet8OrGreater>
<_SentryIsNet9OrGreater>$([MSBuild]::VersionGreaterThanOrEquals($(_SentryTargetFrameworkVersion), 9.0))</_SentryIsNet9OrGreater>
<_SentryIsNet10OrGreater>$([MSBuild]::VersionGreaterThanOrEquals($(_SentryTargetFrameworkVersion), 10.0))</_SentryIsNet10OrGreater>
</PropertyGroup>Keep the copy in Sentry.props, because the repo's own Directory.Build.props imports it. With this change, the Native AOT case uploads from publish/ on both SDKs and the Android app gets the metadata, all without -f. A cli.Tests.ps1 case that publishes without --framework would keep this covered.
version7 adds _SentryIsNet11OrGreater to Sentry.props and checks it in the Native AOT settings. When this fix reaches version7, the copy in Sentry.targets needs that flag too.
Activity
linear-code commentedon Oct 19, 2026
NET-875
ref(msbuild): Keep the net10 and net11 flags in Sentry.props
ref(msbuild): Update the notes that link the two Native AOT checks
ref(msbuild): Remove the unused net10 and net11 flags from Sentry.props