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
I think this is the long standing issue where code submissions that contain both struct definitions and building top-vel statically initialized values for those structs can, in some situations, lead to problems with type loading in .NET
It's the smallest repro of the issue I've seen however, so it's very useful
I'll dig out the canonical issue for this and add this repro
Tecnnically I believe the problem here is that these struct types are nested types - nested in the module. When one is loaded, it tries to load the other, which forces the load of the containing type, which is not yet completed for some reason due to the first load or the evaluation of the static field or something.
This is AFAIK a .NET reflection emit type loading limitation
Placing the struct types or values in a separate namespace of module is a workaround, e.g.
[<Struct>]
type RecordA = { Value : double }
[<Struct>]
type RecordB = { A : RecordA }
module Values =
let v = { A = { Value = 0.0 } }
Activity
dsyme commentedon Sep 3, 2020
I think this is the long standing issue where code submissions that contain both struct definitions and building top-vel statically initialized values for those structs can, in some situations, lead to problems with type loading in .NET
It's the smallest repro of the issue I've seen however, so it's very useful
I'll dig out the canonical issue for this and add this repro
dsyme commentedon Sep 4, 2020
Tecnnically I believe the problem here is that these struct types are nested types - nested in the module. When one is loaded, it tries to load the other, which forces the load of the containing type, which is not yet completed for some reason due to the first load or the evaluation of the static field or something.
This is AFAIK a .NET reflection emit type loading limitation
Placing the struct types or values in a separate namespace of module is a workaround, e.g.
dsyme commentedon Mar 4, 2022
This is fixed by multi-assembly emit which is now used by default #12722