Issue description
Publishing an event produces nullness warning

See EventNullabilityMismatch.fs
WrongNonNullConditionRepro.zip
Choose one or more from the following categories of impact
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
9.0.200
Reproducible code snippet and actual behavior
open System
open System.Windows.Input
/// A command that optionally hooks into CommandManager.RequerySuggested to
/// automatically trigger CanExecuteChanged whenever the CommandManager detects
/// conditions that might change the output of canExecute. It's necessary to use
/// this feature for command bindings where the CommandParameter is bound to
/// another UI control (e.g. a ListView.SelectedItem).
type internal Command(execute, canExecute) =
let canExecuteChanged = Event<EventHandler, EventArgs>()
// CommandManager only keeps a weak reference to the event handler,
// so a strong reference must be maintained,
// which is achieved by this mutable let-binding.
// Can test this via the UiBoundCmdParam sample.
let mutable _handler = null
member this.AddRequeryHandler () =
let handler = EventHandler(fun _ _ -> this.RaiseCanExecuteChanged())
_handler <- handler
member this.RaiseCanExecuteChanged () = canExecuteChanged.Trigger(this, EventArgs.Empty)
interface ICommand with
[<CLIEvent>]
member _.CanExecuteChanged = canExecuteChanged.Publish
member _.CanExecute p = canExecute p
member _.Execute p = execute p
Possible workarounds
No response
Issue description
Publishing an event produces nullness warning
See
EventNullabilityMismatch.fsWrongNonNullConditionRepro.zip
Choose one or more from the following categories of impact
nullconstructs 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
9.0.200
Reproducible code snippet and actual behavior
Possible workarounds
No response