JITTrackingEnabled on coreclr making internals visible to not work correctly
When the F# compiler emits a DebuggableAttribute with JitEnabled false, the built binary can no longer access internals in another assembly when internals visible has been correctly specified.
The attached zip file has two complete fsharp compilers and its coreclr dependencies.
fsc.portable has jit tracking on. fsc-pdbonly has jit tracking off.
Not that corerun fsc.exe, fails for fsc.portable and runs correctly for fsc-pdbonly.
Expected both to work.
Kevin Ransom
The same problem exists for DisableJITcompileOptimizer flag.
Repro:
\\scratch2\scratch\kevinr\bin.zip
unzip bin.zip --- it contains the rtm coreclr+fsharp
dotnet.exe fsi.exe
observe the output:
c:\KevinRansom\visualfsharp\debug\coreclr\bin>dotnet.exe fsi.exe
Unhandled Exception: System.MethodAccessException: Attempt by method 'Microsoft.FSharp.Compiler.Interactive.Shell.MainMain(System.String[])' to access method 'Microsoft.FSharp.Compiler.Lib+SaveAndRestoreConsoleEncoding..ctor()' failed.
at Microsoft.FSharp.Compiler.Interactive.Shell.MainMain(String[] argv)
c:\KevinRansom\visualfsharp\debug\coreclr\bin>cd ..
We need to mask the attribute here: https://github.com/dotnet/coreclr/blob/master/src/vm/baseassemblyspec.cpp#L271
@fadimounir We need to fix this for 2.0. It is blocking F# on .NET Core. If you are not able to get to it, somebody else in Gaurav's team should be able to take care of it. Thanks.
@gkhanna79, can someone on your team take a look at this issue?
@kouvel can take a look.