-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support for nullability annotations #7563
Comments
Took a brief look, and there definitely needs to be made some calls now and then on behavior around null. Just the first class I hit looking a bit at this, and you see something like this: wpf/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows/Markup/ArrayExtension.cs Lines 37 to 41 in c37ab55
It's clear that _arrayType is not nullable, since we don't allow null in the constructor.It is furthermore confirmed when looking in the ProvideValue method:wpf/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows/Markup/ArrayExtension.cs Lines 107 to 110 in c37ab55
However, in the property setter, no null check is made, so it could become null after all: wpf/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows/Markup/ArrayExtension.cs Lines 83 to 87 in c37ab55
So that begs the question: Should we make the Type argument nullable. And if we do that, should we remove the null check in the constructor? Or if we decide to not make the type property nullable, then should we start throwing in the property setter if the value provided is null? Both cases are slight changes in behavior. Or do we just mark it not-nullable (since it seems that is the intent), yet keep the current behavior where we do allow a null to sneak in there? |
In general I think there is much higher chance of the whole annotation project make it if it is metadata changes only, avoiding any changes in behaviour. |
That's how it was done in the runtime. And separate issues were created to fix |
Cc @stephentoub in case he has suggestions or thoughts about organizing this process in WPF based on what we learned. There’s also guidance here Certainly the more the community can do here, and it’s super susceptible to parallelization across interested folks, the more time the WPF maintainers can put on features. |
I was pleased with the process we followed in dotnet/runtime. It was painstaking work, but the net result was very good. The process was effectively this:
|
Finalized the plan for nullability annotations support - top post is updated now. |
Using Microsoft.CodeAnalysis.PublicApiAnalyzers was a prerequisite for the winforms repo (see dotnet/winforms#2705). Is it also the case here? |
@halgab This project has its own baseline component. So I don't think Microsoft.CodeAnalysis.PublicApiAnalyzers is necessary |
Is there a roadmap for this feature? |
[Plan finalized - 3/28]
Based on community feedback, here is the plan for supporting Nullability annotations.
List of assemblies and respective groups:
Thanks @dotMorten for the suggestion
The text was updated successfully, but these errors were encountered: