从Mono 5.8升级到5.14时,Mono / MVC5 / EF6 / PostgreSQL应用程序失败

时间:2018-09-20 12:15:44

标签: postgresql entity-framework mono

我有一个应用程序,可在带有Mvc5,EF6和PostgreSQL Npgsql提供程序的Mono上运行。在单声道5.8上工作正常。但它不适用于mono 5.14。引发异常

"System.TypeInitializationException: The type initializer for 'System.Data.Entity.Core.Objects.ELinq.ExpressionConverter' threw an exception. ---> System.TypeInitializationException: The type initializer for 'MethodCallTranslator' threw an exception. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: key".

我已经编写了一个简单的测试代码来重现此问题。

class Program
{
    static void Main(string[] args)
    {
        Model1 model1 = new Model1();

        var query = from b in model1.mx_busi_info
                    select b;

        foreach (var b in query)
        {
            Console.WriteLine(b.busi_name);
        }
    }
}

任何帮助将不胜感激。

完整的异常堆栈跟踪为:

    Unhandled Exception:
System.TypeInitializationException: The type initializer for 'System.Data.Entity.Core.Objects.ELinq.ExpressionConverter' threw an exception. ---> System.TypeInitializationException: The type initializer for 'MethodCallTranslator' threw an exception. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: key
  at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x00008] in <2943701620b54f86b436d3ffad010412>:0
  at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <2943701620b54f86b436d3ffad010412>:0
  at System.Data.Entity.Core.Objects.ELinq.ExpressionConverter+MethodCallTranslator.InitializeMethodTranslators () [0x00031] in <b7b192e5a05f4f14a14aa0d5b14aeeeb>:0
  at System.Data.Entity.Core.Objects.ELinq.ExpressionConverter+MethodCallTranslator..cctor () [0x00014] in <b7b192e5a05f4f14a14aa0d5b14aeeeb>:0
   --- End of inner exception stack trace ---
  at System.Data.Entity.Core.Objects.ELinq.ExpressionConverter+<GetTranslators>d__0.MoveNext () [0x00345] in <b7b192e5a05f4f14a14aa0d5b14aeeeb>:0
  at System.Data.Entity.Core.Objects.ELinq.ExpressionConverter.InitializeTranslators () [0x00050] in <b7b192e5a05f4f14a14aa0d5b14aeeeb>:0
  at System.Data.Entity.Core.Objects.ELinq.ExpressionConverter..cctor () [0x00000] in <b7b192e5a05f4f14a14aa0d5b14aeeeb>:0
   --- End of inner exception stack trace ---
  at System.Data.Entity.Core.Objects.ELinq.ELinqQueryState.CreateExpressionConverter () [0x0000c] in <b7b192e5a05f4f14a14aa0d5b14aeeeb>:0
  at System.Data.Entity.Core.Objects.ELinq.ELinqQueryState.GetExecutionPlan (System.Nullable`1[T] forMergeOption) [0x0008d] in <b7b192e5a05f4f14a14aa0d5b14aeeeb>:0
  at System.Data.Entity.Core.Objects.ObjectQuery`1+<>c__DisplayClass7[T].<GetResults>b__6 () [0x0000b] in <b7b192e5a05f4f14a14aa0d5b14aeeeb>:0
  at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T] (System.Func`1[TResult] func, System.Data.Entity.Infrastructure.IDbExecutionStrategy executionStrategy, System.Boolean startLocalTransaction, System.Boolean releaseConnectionOnSuccess) [0x0008a] in <b7b192e5a05f4f14a14aa0d5b14aeeeb>:0
  at System.Data.Entity.Core.Objects.ObjectQuery`1+<>c__DisplayClass7[T].<GetResults>b__5 () [0x00033] in <b7b192e5a05f4f14a14aa0d5b14aeeeb>:0
  at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult] (System.Func`1[TResult] operation) [0x00000] in <b7b192e5a05f4f14a14aa0d5b14aeeeb>:0
  at System.Data.Entity.Core.Objects.ObjectQuery`1[T].GetResults (System.Nullable`1[T] forMergeOption) [0x00093] in <b7b192e5a05f4f14a14aa0d5b14aeeeb>:0
  at System.Data.Entity.Core.Objects.ObjectQuery`1[T].<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0 () [0x00000] in <b7b192e5a05f4f14a14aa0d5b14aeeeb>:0

1 个答案:

答案 0 :(得分:0)

您似乎已受到this regression的影响。

但是a fix in Mono已被合并。

您可能需要等待下一个5.16版本,该版本可能已将此错误修复程序作为反向端口接收。