Bug 26821 - fsharpc & fsharpi crashes with invalid IL code
Summary: fsharpc & fsharpi crashes with invalid IL code
Status: RESOLVED UPSTREAM
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-02-06 18:43 UTC by Manuel
Modified: 2015-03-13 12:10 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED UPSTREAM

Description Manuel 2015-02-06 18:43:28 UTC
With latest mono source code, fsharpc & fsharpi break with an InvalidProgramException. The F# compiler builds and installs without reporting any errors. Exception happens when any of those commands are executed. 

For fsharpi, the stack trace is:

System.InvalidProgramException: Invalid IL code in System.Diagnostics.Process:GetCurrentProcess (): IL_0000: ret      


  at Microsoft.FSharp.Compiler.Interactive.Shell+FsiTimeReporter..ctor (System.IO.TextWriter outWriter) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.Interactive.Shell+FsiEvaluationSession..ctor (System.String[] argv, System.IO.TextReader inReader, System.IO.TextWriter outWriter, System.IO.TextWriter errorWriter) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.Interactive.Shell.evaluateSession@2382 (System.String[] argv, Microsoft.FSharp.Core.Unit unitVar0) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.Interactive.Shell.MainMain (System.String[] argv) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.Interactive.Main.FsiMain (System.String[] argv) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidProgramException: Invalid IL code in System.Diagnostics.Process:GetCurrentProcess (): IL_0000: ret

And for fsharpc, it is:

System.InvalidProgramException: Invalid IL code in System.Collections.Generic.Stack`1:System.Collections.Generic.IEnumerable<T>.GetEnumerator (): IL_0000: ret      


  at Microsoft.FSharp.Collections.SeqModule.ToList[IDisposable] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.Driver+DelayedDisposables.System-IDisposable-Dispose () [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.Driver.typecheckAndCompile (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter, Microsoft.FSharp.Compiler.ErrorLoggerProvider errorLoggerProvider) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.Driver.mainCompile (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.CommandLineMain+Driver.main (System.String[] argv) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Compiler.CommandLineMain.main (System.String[] argv) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidProgramException: Invalid IL code in System.Collections.Generic.Stack`1:System.Collections.Generic.IEnumerable<T>.GetEnumerator (): IL_0000: ret
Comment 1 Marek Safar 2015-03-13 12:10:37 UTC
This is fsharp issue, they have hardcoded 4.0 path for execution. Mono master no longer has 4.0 assemblies for execution only 4.5 are available.

There is a pull request to fix the issue but it's stuck in fsharp queue.

https://github.com/fsharp/fsharp/pull/389