Skip to content

Conversation

@jdswcz
Copy link
Contributor

@jdswcz jdswcz commented Apr 6, 2025

Sentry DotNet since version 5.2.0 (and until the most recent 5.5.0) can't be used in UWP projects because they fail to compile with following error:

Sentry : Gatekeeper error GK0018 : GK0018 Value type 'Sentry.Internal.FnvHash' has an explicit default constructor which is unsupported. Use an initialization function instead.

This happens with .NET Native compilation and static analysis enabled. Versions 5.1.1 and older aren't producing this issue as they don't contain FnvHash struct.

Similar error was solved in the past with other objects: #2415

Please test my changes before merging. As a customer, I want this issue quickly fixed, so I am helping you. However, I don't want to spend hours getting compilation of sentry working and testing it within my package. 💯 Thank you for your understanding.

@codecov
Copy link

codecov bot commented Apr 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.65%. Comparing base (495e742) to head (322c795).
Report is 536 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4085      +/-   ##
==========================================
- Coverage   75.73%   73.65%   -2.08%     
==========================================
  Files         357      444      +87     
  Lines       13466    15995    +2529     
  Branches     2671     3152     +481     
==========================================
+ Hits        10198    11781    +1583     
- Misses       2593     3400     +807     
- Partials      675      814     +139     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jamescrosswell
Copy link
Collaborator

Thanks for the PR @jdswcz !

I'm happy to get this to go green in CI. However ideally I'd also like to confirm the code fixes the problem and to do that I need to be able to reproduce the problem.

It looks like to reproduce it static analysis needs to be enabled for .NET Native. How are you doing that? I tried adding <EnableNETAnalyzers>true</EnableNETAnalyzers> to a UWP application here and building it in release mode (using Sentry 5.5.0) but didn't get any warnings or errors from an analyser.

@jdswcz
Copy link
Contributor Author

jdswcz commented Apr 7, 2025

Thanks for the PR @jdswcz !

I'm happy to get this to go green in CI. However ideally I'd also like to confirm the code fixes the problem and to do that I need to be able to reproduce the problem.

It looks like to reproduce it static analysis needs to be enabled for .NET Native. How are you doing that? I tried adding <EnableNETAnalyzers>true</EnableNETAnalyzers> to a UWP application here and building it in release mode (using Sentry 5.5.0) but didn't get any warnings or errors from an analyser.

image

These are our Release build settings that produce this error.

Edit: In the past, I was reporting this support and was sending minimum reproducible sample. But I am worried I don't have it now (it's two years ago).

@jamescrosswell
Copy link
Collaborator

Thanks @jdswcz - if I use those build setting in Visual Studio then I get an error from gatekeeper when trying to run the app in release mode... but it's not clear what the error is:

Error ILT0005: 'C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\runtime.win10-x64.microsoft.net.native.compiler\2.2.12-rel-31116-00\tools\x64\ilc\ilc.exe --gatekeeper @"C:\code\App1\obj\x64\Release\ilc\intermediate\gkargs.rsp"' returned exit code 1 App1

I'm wondering how you got the more detailed/actionable error message?

@jamescrosswell jamescrosswell self-requested a review April 7, 2025 23:38
@jamescrosswell jamescrosswell merged commit ad6ce30 into getsentry:main Apr 8, 2025
26 checks passed
@jdswcz
Copy link
Contributor Author

jdswcz commented Apr 9, 2025

Thanks @jdswcz - if I use those build setting in Visual Studio then I get an error from gatekeeper when trying to run the app in release mode... but it's not clear what the error is:

Error ILT0005: 'C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\runtime.win10-x64.microsoft.net.native.compiler\2.2.12-rel-31116-00\tools\x64\ilc\ilc.exe --gatekeeper @"C:\code\App1\obj\x64\Release\ilc\intermediate\gkargs.rsp"' returned exit code 1 App1

I'm wondering how you got the more detailed/actionable error message?

Apologies for later response. You probably figured out, however, you can just open command line and run the command mentioned in error. Something like:

C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\runtime.win10-x64.microsoft.net.native.compiler\2.2.12-rel-31116-00\tools\x64\ilc\ilc.exe --gatekeeper @"C:\code\App1\obj\x64\Release\ilc\intermediate\gkargs.rsp" >> output.txt

Then, in the output.txt, you'll see the gatekeeper log. You may see some warnings and info messages. However, only line marked as 'Error' cause compilation to fail.

@jdswcz
Copy link
Contributor Author

jdswcz commented Apr 9, 2025

Just tested Sentry nuget package v 5.5.1 and I can confirm the issue was resolved.

Thank you very much for your effort.

@jdswcz jdswcz deleted the FixNetNativeCompilation branch April 9, 2025 05:29
@jamescrosswell
Copy link
Collaborator

Awesome, thanks @jdswcz for raising this and for making the PR! 🙏🏻

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.

3 participants