Bug 10300 - LoadAssembly in csharp shell works when running on Mono 3.0.3, but not when running on .NET
Summary: LoadAssembly in csharp shell works when running on Mono 3.0.3, but not when r...
Status: NEW
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2013-02-14 11:57 UTC by Scott Stephens
Modified: 2013-12-04 17:39 UTC (History)
2 users (show)

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 for Bug 10300 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Scott Stephens 2013-02-14 11:57:55 UTC
This is a bug that hits the csharp shell (and probably the underlying Mono.CSharp.Evaluator) only when running on MSFT .NET, not when running on Mono.

It's triggered when loading a DLL from the Math.NET numerics project (can download binaries here: http://mathnetnumerics.codeplex.com/downloads/get/616759).  Unpack binaries to C:\MathNet.Numerics-, and unblock the MathNet.Numerics.dll file (right click the file, click the Unblock button at bottom right).  Then try the following:

First launch csharp shell using Mono 3.0.3 with:

"C:\Program Files (x86)\Mono-3.0.3\bin\csharp.bat"

Then run following in shell:

var standard_normal = new MathNet.Numerics.Distributions.Normal();

This will provide the expected output:
Normal(Mean = 0, StdDev = 1)

Then launch csharp shell using .NET framework with:

"C:\Program Files (x86)\Mono-3.0.3\lib\mono\4.5\csharp.exe"

Then run the same lines in the shell, and on the last line you'll get:

System.IO.FileNotFoundException: Could not load file or assembly 'MathNet.Numerics, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. File name: 'MathNet.Numerics, Version=, Culture=neutral, PublicKeyToken=null'
   at <InteractiveExpressionClass>.Host(Object& $retval)
   at Mono.CSharp.Evaluator.Evaluate(String input, Object& result, Boolean& result_set)
   at Mono.CSharpShell.Evaluate(String input)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

This is especially odd, because you can then run 

from x in AppDomain.CurrentDomain.GetAssemblies() where x.GetName().Name == "MathNet.Numerics" select x.GetName().FullName

you can see that .NET thinks it's already loaded the assembly that it just couldn't find.
Comment 1 Scott Stephens 2013-03-06 11:53:15 UTC
Still an issue in Mono 3.0.6.
Comment 2 Scott Stephens 2013-04-12 15:21:11 UTC
Still an issue in Mono 3.0.9.
Comment 3 Scott Stephens 2013-10-01 19:27:37 UTC
Still an issue in Mono 3.2.3.