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
URL:
Depends on:
Blocks:
 
Reported: 2013-02-14 11:57 UTC by Scott Stephens
Modified: 2013-12-04 17:39 UTC (History)
2 users (show)

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


Attachments

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-2.4.0.26, 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:

LoadAssembly(@"C:\MathNet.Numerics-2.4.0.26\Net40\MathNet.Numerics.dll");
var standard_normal = new MathNet.Numerics.Distributions.Normal();
standard_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=2.4.0.26, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. File name: 'MathNet.Numerics, Version=2.4.0.26, 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.