-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Determine solution for nullable attributes and the new public API to access them #1991
Comments
I had a thought here, that I am copying below: One thought I had here is if we could annotate these new [RequiresFeature("System.Reflection.NullabilityInfo")]
public NullabilityInfo Create(ParameterInfo parameterInfo) {} And what this would mean is: When the linker sees a method with Then in This would mean, if the feature switch wasn't "on", the attributes could be trimmed safely. If the feature switch was "on", then the attributes won't be trimmed. And then the APIs would work just fine in a trimmed app. And in the off case where someone was reading the attributes directly, not through these APIs, they could turn the feature switch on for the app in the usual way, and the attributes wouldn't be trimmed. |
Thanks for the idea @eerhardt. I like:
What I don't like:
|
Expanding on what @MichalStrehovsky mentioned in https://github.com/mono/linker/issues/2078: We should also consider the foreach (var a in typeof(Foo).GetCustomAttributes()) // ... This should either keep all custom attributes on |
@vitek-karas Can this be closed since we have an extra new feature switch to make this one API work? We still have dotnet/runtime#103934 open tracking the fact that IL Linker is breaking user code without warnings when attribute stripping is enabled in general. |
I think it can - the specific issue is resolved. And generic attribute trimming is... problematic. |
We will need to come up with a linker solution for the new API proposed here: dotnet/runtime#29723.
The text was updated successfully, but these errors were encountered: