Description
A couple of different options
Use built in attributes
The RuntimeFeature.IsDynamicCodeSupported Property looks like it might do what we want in many cases (I think we're using AotHelper.IsNativeAot
where we should probably be checking for Trimming compatibility instead in some cases). Need to do a search for uses of AotHelper.IsNativeAot
and a bit of a review of these.
Generate these at compile time
For this AotHelper, instead of:
sentry-dotnet/src/Sentry/Internal/AotHelper.cs
Lines 18 to 19 in 217c11c
Could we instead write an attribute at compile time? I imagine it's a lot cheaper (worth measuring) than trying to get a stack trace on a static constructor:
Something like this:
sentry-dotnet/src/Sentry/buildTransitive/Sentry.targets
Lines 8 to 29 in 217c11c
Here's a PR that added writing the attribute at build time as a reference: #1739
Originally posted by @bruno-garcia in #2920 (comment)
References
- More info available here: https://devblogs.microsoft.com/dotnet/creating-aot-compatible-libraries/
Metadata
Metadata
Assignees
Type
Projects
Status