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# (show other bugs)
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)

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


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.

Note You need to log in before you can comment on or make changes to this bug.