Closed atomsk-0 closed 3 days ago
Hey @atomsk-0, sorry to see you run into troubles. I wonder if this is related to some changes in .NET 9.
ye could be, seems to work fine in .NET 8 project published with NativeAot enabled
Thanks for confirming! I guess it's time to check out the .NET 9 preview!
Also thanks for trying .NET 9 preview and reporting bugs to Sentry!! this is huge help
I'm experiencing this issue even with .NET 8 - does anyone have recommendations for a workaround? I'm cross-compiling to x64 from ARM64
EDIT: I just built Sentry native myself and dropped the DLL and crashpad into my publish folder and it seems to work.
I'm experiencing this issue even with .NET 8
That's not great. Could you share your setup or maybe even a minimal repro for us to take a look at?
I know that we're having some trouble cross-compiling sentry-native to ARM64 but I wasn't aware that there was also an issue going the other way around.
I'm experiencing this issue even with .NET 8
That's not great. Could you share your setup or maybe even a minimal repro for us to take a look at?
I know that we're having some trouble cross-compiling sentry-native to ARM64 but I wasn't aware that there was also an issue going the other way around.
My setup is:
That is pretty much it. On any app, even .NET 8, running dotnet publish -c Release -r win-x64
yields a successful build of the app, but sentry-native can't be found at runtime and the output directory does not contain any sentry artifacts. If I build sentry-native myself and place the DLL and its associated artifacts in the output directory, the application runs.
We currently have quite a few things in the transitive build process which are "locked" to net8.0 and won't work with net9.0 and later... eg. https://github.com/getsentry/sentry-dotnet/blob/61f90d663052feb1f1becd99eb44ad0e3892f27b/src/Sentry/Platforms/Native/buildTransitive/Sentry.Native.targets#L9-L15
Note the $(TargetFramework.StartsWith('net8'))
condition.
@andrewmd5 do you get the same result if you try to specify net8.0 explicitly when running dotnet publish?
dotnet publish -c Release -r win-x64 -f net8.0
We currently have quite a few things in the transitive build process which are "locked" to net8.0 and won't work with net9.0 and later... eg.
sentry-dotnet/src/Sentry/Platforms/Native/buildTransitive/Sentry.Native.targets
Lines 9 to 15 in 61f90d6
Note the `$(TargetFramework.StartsWith('net8'))` condition. [@andrewmd5](https://github.com/andrewmd5) do you get the same result if you try to specify net8.0 explicitly when running dotnet publish? dotnet publish -c Release -r win-x64 -f net8.0
Thanks for sharing that file, I suspected it might be the source of the problem, and on a second look it was. I submitted a PR.
Thanks for sharing that file, I suspected it might be the source of the problem, and on a second look it was. I submitted a PR.
Big 🙏 thank you for the PR @andrewmd5 - It's not quite the issue I'd thought it was!
I think we'll need to modify the same file to add support for .NET 9 as well but we can do that in a separate PR as I think that is a separate issue to the one addressed in your contribution.
My pleasure. I did a quick test and modified the targets to accept NET8+ and it seemed to work fine.
Is there a task list for .NET 9?
This got resolved and should land soon:
Is there a task list for .NET 9?
@jamescrosswell updated the description of #3513 to stay up to date with the currently open tasks.
net9.0 support will be included in version 5 of the SDK.
Package
Sentry
.NET Flavor
.NET
.NET Version
9.0.100-preview.6.24328.19
OS
Windows
SDK Version
4.9.0
Self-Hosted Sentry Version
No response
Steps to Reproduce
<PublishAot>true</PublishAot>
to csprojdotnet publish -c Release -r win-x64
Expected Result
Program starting up normally
Actual Result
Throws this exception when trying to init sentry sdk. (Works normally without PublishAot flag enabled