Usage of struct tuples (struct (0,0)) with the System.Nullable<T> type seems to cause unexpected compiler errors with F#. When attempting to directly instantiate a Nullable(struct (0,0)), the error A generic construct requires that the type 'struct (a * b)' have a public default constructor is reported. When attempting to instantiate a Nullable using a struct tuple bound to an identifier, such as Nullable(x), the error internal error: tcrefOfAppTy (Failure) is thrown. Simply unboxing the struct tuple as a ValueTuple<int,int> seems to resolve both of these errors.
let x = System.Nullable(struct (0, 0))
This produces the error: error FS0001: A generic construct requires that the type 'struct ('a * 'b)' have a public default constructor
let x = struct(0, 0)
System.Nullable(x)
This produces the error error FS0073: internal error: tcrefOfAppTy (Failure)
let x = struct(0, 0)
let y = System.Nullable(struct (0, 0) |> unbox<System.ValueTuple<int,int>>)
let z = System.Nullable(x |> unbox<System.ValueTuple<int,int>>)
This executes without errors.
Creating instances of Nullable with a struct tuple should work without error, equivalent to the behavior for using System.ValueTuple.
Different compiler errors are reported when attempting to instantiate a Nullable with a struct tuple.
Unboxing the struct tuple to a System.ValueTuple resolves the compiler errors and executes as expected.
Please see this StackOverflow post for the original report of this behavior.
Windows 10
.NET Framework 4.7.1
Visual Studio 2017
Accidentally confirmed that this is still an issue.
I just stumbled upon this issue in F# 4.7.0.0.
I consider it a major hickup for C# F# interop.
Visual F# Tools 10.9.1.0 for F# 4.7 16.6.0-beta.20217.4+1c969cac25e2d38d71872efe6c8226029e42bb59
Microsoft Visual F# Tools 10.9.1.0 for F# 4.7
Though there's a simple workaround: create an explicit struct instead.
e.g. instead of defining the function signature like:
abstract (string Name, int Value)? GetStuff();
do it like this:
struct Stuff
{
public string Name;
public int Value;
}
abstract Stuff? GetStuff();
override this.GetStuff() =
Nullable(Stuff(Name="Answer", Value=42))
Just to note that the internal compiler error is not present anymore, and is instead:

Treating as duplicate of #7618