It is interop between C# and F#
In F#,
type test =
{
value: int
}
type Wrapper (value: test) =
member val Value = value with get, set
let trythis = new Wrapper(null) // error as expected
However, in C#
var trythis = new Wrapper(null); //this runs fine
The non-nullable constraint on types is an F# specific feature and so it does not have any representation in .NET (and therefore C# does not respect it).
In fact, you can workaround this even in F# using an unsafe
Unchecked.defaultof<_>value:This is very useful if you want to check for
nullin an object that is exposed to C#: