getsentry / getsentry/sentry-dotnet
Replace AotHelper.IsNativeAot with FeatureGuardAttribute
- Dominant language
- C#
- Stars
- 770
- Forks
- 248
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 49
Description
We currently have our own bespoke implementaion of something that approximates what FeatureGuardAttribute does, to disable parts of our SDK in trimming/AOT scenarios at runtime.
net9.0 introduces a [`FeatureGuardAttribute`]() that we could look at leveraging instead, to make this more easily identifiable and readable.
### Challenges
Unfortunately `FeatureGuardAttribute` requires support from the runtime so it's only available in net9.0... which means if we do use it, we'll need to wrap it in conditional compilation code and would still need to include some alternate code that would be used instead with older runtimes.
The result will very likely not be anything more readable... but it may enable a smaller binary for SDK users. We can potentially use the FeatureSwitchDefinitionAttribute to define parts of the SDK that can be trimmed, to help users reduce the size of their apps. We'd need to play around with it to check if this works...
See also:
* getsentry/sentry-dotnet#3222
Contributor guide
Assessment
This issue has not been assessed yet.