I can also reproduce this on macOS 10.11, mono 4.6.
Minimum Playback:
module X = type Y = Y let l = [| Y |]
Workaround :
module X = type Y = Y let g = List.toArray [ Y ]
So, in your case, replace both internal and external declarations [| |] [| |] .
Why does this only happen in VS Code / fsharpi, but not in Xamarin?
If you activate the activity monitor, you will see that VS Code / fsharpi uses /Library/Frameworks/Mono.framework/Versions/4.6.0/lib/mono/4.5/fsi.exe , but Xamarin Studio uses FCS Xamarin Studio.app/Contents/Resources/lib/monodevelop/AddIns/BackendBindings/MonoDevelop.FSharpInteractive.Service.exe You can also check the version on the first message from the interactive one ( F# Interactive for F# 4.1 , this may be different).
Finally, I believe this is a bug in mono + dynamic builds, caused by the code emitted by fsi . Compiling this code in exe works fine on all platforms (and if you check that the generated IL looks pretty normal).
source share