-
Notifications
You must be signed in to change notification settings - Fork 793
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
Nullness issue - Spurious nullness warning with flexible type #18056
Comments
I just reread the section "Inference in generic code" from Nullable Reference Types in F# 9. I thought perhaps it meant that the following should work without a warning, but a warning is still generated
|
Could you please also include which warning this produces incl. the range (= coordinates in code) for it? |
The warning is:
In VSCode, |
I agree. I would be great is This is a example using Microsoft.Extensions.Logging LoggerExtensions.BeginScope(ILogger, String, Object[]) Method. Is there a way to disable the warning for just a single line? This disables the warning for the entire file: #nowarn "3261" // use IDisposable | null |
This pattern is also very prevalent when using System.Diagnostics.Activity and related types. It's annoying to deal with and is one of the reasons that @TheAngryByrd made some helper members to paper over the experience. |
Hopefully soon. |
I'm confirming that I am able to use use scope = this.BeginScope props |> Unchecked.nonNull This will work until |
Issue description
I get a nullness warning with the following:
Since the dispose function allows null, I do not think a warning should be generated. No warning is generated for a non-flexible type, e.g.:
Choose one or more from the following categories of impact
null
constructs in code not using the checknulls switch.null
,not null
).Operating System
Windows (Default)
What .NET runtime/SDK kind are you seeing the issue on
.NET SDK (.NET Core, .NET 5+)
.NET Runtime/SDK version
net9.0
Reproducible code snippet and actual behavior
No response
Possible workarounds
No response
The text was updated successfully, but these errors were encountered: