I've just written a simple method that C# can see but calling it (even with valid arguments) throws up at run-time.
example that fails at runtime:
F#:
namespace Library1
type Class1() =
member __.Foo = "F#"
module MyModule =
// fails at run-time
let inline fOnly (x:^a) : string = (^a:(member Foo: _) x)
// works from C# and F# so I know it's not a problem with my stp
let testFOnly () = fOnly (Class1())
C# consumer:
namespace ConsoleApplication1
{
class Program
{
var class1 = new Library1.Class1();
// NotSupportedException
var result = Library1.MyModule.fOnly(class1);
Console.ReadLine();
}
}
Why does this compile, then fail at run-time? Am I doing something wrong or should I just assume any attempt to call an stp method from C# will always fail? Should I then attempt to hide them from C#?