You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While translating some C# code into F# I noticed some unexpected behavior with structlayout.
Having
type MyType =
struct
val a: int
end
is fine, but having
open System.Runtime.InteropServices
[<type:StructLayout(LayoutKind.Sequential, Pack=1)>]
type LayoutType =
struct
val a: int
end
results in an error:
error FS0193: internal error: Could not load type 'LayoutType' from assembly 'FSI-ASSEMBLY, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' because field 'a@' was not given an explicit offset.
Setting Pack=0 and everything is fine.
I tried this out in VS2013 and VS2015 CTP 6, and the results are identical.
1 is a valid value for pack,
setting it to 1 or any other non zero that I tried for that matter results in:
error FS0193: internal error: Could not load type 'LayoutType' from assembly 'FSI-ASSEMBLY, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' because field 'a@' was not given an explicit offset.
While translating some C# code into F# I noticed some unexpected behavior with structlayout.
Having
is fine, but having
results in an error:
Setting
Pack=0
and everything is fine.I tried this out in VS2013 and VS2015 CTP 6, and the results are identical.
/@kasperhj
The text was updated successfully, but these errors were encountered: