3

私はWindows7でAutoMapper.NET 4.0を使用してアプリケーションを開発しています。今日、新しいWindows 8マシンからソースコードを取得し、アプリをビルドして実行すると、次のように表示されます。SVN

InvalidProgramException:共通言語ランタイムが無効なプログラムを検出しました

ソースコードを再構築すると、他の3台のWindows7マシンすべてで正常に動作します。私はそれがWindows8で問題になると思います。私は次の小さなコンソールアプリケーションを書きます。私はWindows8でソースコードを作成しましたが、Windows 7では正常に動作しますが、Windows 8では動作しません。したがって、Windows8のランタイムに関する問題です。基になる型がデフォルトではないenum型に問題があるようです。タイプ、Int32。

グーグルした後、人々はそれがJITコンパイラについてであると言いますが、私はまだわかりません。Windows7とWindows8の両方でVS2010を対象とした.NET4.0を使用しています。Windows8でこれについて何か変更はありますか?AutoMapperのソースコードを読んでいます。C#やCLIで本当に何か問題があると思います。手がかりを与えてください。ありがとう。

class Program
{
    enum PriorityModel  { High, Normal, Low }
    enum PriorityDto { High, Normal, Low }

    enum PriorityModel2 : byte { High, Normal, Low }
    enum PriorityDto2 : byte { High, Normal, Low }

    enum PriorityModel3 : short { High, Normal, Low }
    enum PriorityDto3 : short { High, Normal, Low }


    static void Main(string[] args)
    {
        Mapper.CreateMap<PriorityModel, PriorityDto>();  // OK
        Mapper.CreateMap<PriorityModel2, PriorityDto2>();  // [InvalidProgramException: Common Language Runtime detected an invalid program.]
        Mapper.CreateMap<PriorityModel3, PriorityDto3>();  // [InvalidProgramException: Common Language Runtime detected an invalid program.]

        Console.Read();
    }
}

例外スタックトレース:

[InvalidProgramException: Common Language Runtime detected an invalid program.]
   System.Runtime.CompilerServices.RuntimeHelpers._CompileMethod(IRuntimeMethodInfo method) +0
   System.Reflection.Emit.DynamicMethod.CreateDelegate(Type delegateType, Object target) +43
   System.Linq.Expressions.Compiler.LambdaCompiler.CreateDelegate() +81
   System.Linq.Expressions.Compiler.LambdaCompiler.Compile(LambdaExpression lambda, DebugInfoGenerator debugInfoGenerator) +205
   AutoMapper.DelegateFactory.CreateGet(FieldInfo field) +156
   AutoMapper.Internal.FieldGetter..ctor(FieldInfo fieldInfo) +60
   AutoMapper.ReflectionHelper.ToMemberAccessor(MemberInfo accessorCandidate) +124
   AutoMapper.TypeMapFactory.CreateTypeMap(Type sourceType, Type destinationType, IMappingOptions options, MemberList memberList) +269
   AutoMapper.ConfigurationStore.CreateTypeMap(Type source, Type destination, String profileName, MemberList memberList) +86
   AutoMapper.ConfigurationStore.CreateMap(String profileName, MemberList memberList) +45
   AutoMapper.ConfigurationStore.CreateMap() +13
   AutoMapper.Mapper.CreateMap() +51
4

0 に答える 0