使用CsharpRepl时的System.TypeLoadException(单声道shell)

时间:2012-06-11 22:48:07

标签: c# mono

在我放弃这个c#解释器之前我想我会检查是否有人知道这里出了什么问题。它抱怨的类型是eloquera.client.dll。

c:\Program Files\Mono-2.10.8\bin>csharp
Mono C# Shell, type "help;" for help

Enter statements below.
csharp> LoadAssembly(@"C:\WebApp1\WebApp1\bin\webapp1.dll");
csharp> LoadAssembly(@"C:\WebApp1\WebApp1\bin\eloquera.client.dll");
csharp> using WebApp1.Models.Data_Access;
csharp> using WebApp1.Models.Persisted_classes;
csharp> using Eloquera.Client;
csharp> using System.Linq.Expressions;
csharp>
csharp> var repository = new EloqueraRepository();
csharp> var result = repository.GetAll<CustomMembershipUser>();
System.TypeLoadException: Could not load type 'Eloquera.Client.DB' from assembly
 'Eloquera.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=170cadcdba67
be6c'.
  at Class3.Host (System.Object& $retval) [0x00000] in <filename unknown>:0
  at Mono.CSharp.Evaluator.Evaluate (System.String input, System.Object& result,
 System.Boolean& result_set) [0x00000] in <filename unknown>:0
  at Mono.CSharpShell.Evaluate (System.String input) [0x00000] in <filename unkn
own>:0
csharp>
csharp>
csharp>

编辑:关注该问题类型:

C:\Program Files\Mono-2.11\bin>csharp
Mono C# Shell, type "help;" for help

Enter statements below.
csharp> LoadAssembly(@"C:\WebApp1\WebApp1\bin\webapp1.dll");
csharp> LoadAssembly(@"C:\WebApp1\WebApp1\bin\eloquera.client.dll");
csharp> using WebApp1.Models.Data_Access;
csharp> using WebApp1.Models.Persisted_classes;
csharp> using Eloquera.Client;
csharp> using System.Linq.Expressions;
csharp> string server = "server=localhost;password=pwd;options=none;";
csharp> Console.WriteLine(server);
server=localhost;password=pwd;options=none;
csharp> DB db = new DB(server);
(1,10): error CS0584: Internal compiler error: Unexpected error when loading typ
e `Eloquera.Client.DB'

编辑:升级Eloquera安装到EloqueraDatabase CE 4.51 .NET4.0 x32并再次尝试。仍然没有工作,但结果可能会更有希望:

c:\Program Files\Mono-2.10.8\bin>csharp
Mono C# Shell, type "help;" for help

Enter statements below.
csharp> LoadAssembly(@"C:\WebApp1\WebApp1\bin\webapp1.dll");
csharp> LoadAssembly(@"C:\Program Files\Eloquera\Eloquera Server 4.0\Lib\Eloquer
a.Client.dll");
csharp> using WebApp1.Models.Data_Access;
csharp> using WebApp1.Models.Persisted_classes;
csharp> using System.Linq.Expressions;
csharp> using Eloquera.Client;
csharp>
csharp>
csharp> string server = "server=localhost;password=pwd;options=none;";
csharp> Console.WriteLine(server);
server=localhost;password=pwd;options=none;
csharp> DB db = new DB(server);
csharp> db.OpenDatabase("MockDB");
Eloquera.Client.EloqueraException: The connection to the server localhost on the
 port 43962 cannot be established.

The requested feature is not implemented.
  at Eloquera.Client.DB.OpenConnection () [0x00000] in <filename unknown>:0
  at Eloquera.Client.DB.OpenDatabase (System.String dbName) [0x00000] in <filena
me unknown>:0
  at Class5.Host (System.Object& $retval) [0x00000] in <filename unknown>:0
  at Mono.CSharp.Evaluator.Evaluate (System.String input, System.Object& result,
 System.Boolean& result_set) [0x00000] in <filename unknown>:0
  at Mono.CSharpShell.Evaluate (System.String input) [0x00000] in <filename unkn
own>:0
csharp>

2 个答案:

答案 0 :(得分:0)

过去我在Mono 2.10.x中看到过一些TypeLoadException问题。

我建议升级到Mono 2.11.3或更高版本。

答案 1 :(得分:0)

尝试LoadAssembly(@“C:\ WebApp1 \ WebApp1 \ bin \ Eloquera.Client.dll”);或匹配与命名空间相同的大小写。

相关问题