-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Remove all use of <Nullable>annotations</Nullable> #90401
Conversation
We've inadvertently shipped multiple libraries with incorrect nullable reference type annotations because: a) Their ref assemblies aren't actually being shipped, and/or b) Their src projects using `<Nullable>annotations</Nullable>` `<Nullable>annotations</Nullable>` means "I'm nullable annotated but don't validate them", which means consumers of these libraries see annotations that we haven't thoughtfully added or reviewed. This removes all use of it and gets us back to a place where we're only shipping nullable annotations for libraries where we've done the work to ensure they're correct. We can subsequently finish annotating these stragglers.
Tagging subscribers to this area: @dotnet/area-infrastructure-libraries Issue DetailsWe've inadvertently shipped multiple libraries with incorrect nullable reference type annotations because: a) Their ref assemblies aren't actually being shipped, and/or b) Their src projects using
This removes all use of it and gets us back to a place where we're only shipping nullable annotations for libraries where we've done the work to ensure they're correct. We can subsequently finish annotating these stragglers. Fixes #78036
|
The build failures on allconfigurations are concerning. Interop source generator isn't running. Having a look at binlog. |
Interesting -- here's the cause: runtime/eng/generators.targets Lines 6 to 9 in 0dfe81a
@ViktorHofer could that permit the generator if nullable was disabled but the project explicitly included those polyfill files (via property)? |
Thanks for tracking it down. Why are we disabling the generator in that case? Is it because the files in question have nullable annotations that would result in warnings when nullable is disabled? If that's the case, we should instead be suppressing the warnings with |
Agreed. To add to that - I would expect the user gesture for using the source generator to actually address it with attribute usage - so even if the generator was included it ought to be a noop unless someone added those attributes. |
That's infrastructure owned by @jkoritzinsky. Jeremy, please take a look. |
The polyfill sources have been annotated with nullable reference types and we were getting errors on compiling them when nullable reference types were disabled. Does Roslyn allow using |
|
…ies. Convert a DllImport in HostWriter that now gets the polyfill experience.
Build failure is dotnet/dnceng#450 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was annotated in #67513. Removing <Nullable>
and <NoWarn>
from M.E.H.Systemd's ref and src csproj seems to build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems to build
That doesn't guarantee they're correct, though.
Someone should re-review the annotations to ensure they're correct, submitting a separate PR to flip it to enabled.
I'm surprised, for example, that there's no validation for the loggerFactory argument here:
runtime/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdLifetime.cs
Line 32 in 71a3d36
public SystemdLifetime(IHostEnvironment environment, IHostApplicationLifetime applicationLifetime, ISystemdNotifier systemdNotifier, ILoggerFactory loggerFactory) |
It'll null ref if someone passes null, something we try to avoid in general even for non-nullable parameters (and the other args are validated). Logging is generally also optional. Is that supposed to be a nullable factory and the ctor uses a default nop logger if it's null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc: @maxkoshevoi, @eerhardt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've inadvertently shipped multiple libraries with incorrect nullable reference type annotations because: a) Their ref assemblies aren't actually being shipped, and/or b) Their projects are using
<Nullable>annotations</Nullable>
<Nullable>annotations</Nullable>
means "I'm nullable annotated but don't validate them", which means consumers of these libraries see annotations that we haven't thoughtfully added or reviewed.This removes all use of it and gets us back to a place where we're only shipping nullable annotations for libraries where we've done the work to ensure they're correct. We can subsequently finish annotating these stragglers, for which I opened #90400.
Fixes #78036