Note that there are some explanatory texts on larger screens.

plurals
  1. POMoving to Windows 8 get "InvalidProgramException: Common Language Runtime detected an invalid program"
    primarykey
    data
    text
    <p>I'm developing a <code>.NET 4.0</code> application with <a href="https://github.com/AutoMapper" rel="nofollow">AutoMapper</a> on Windows 7. Today I get the source code from <code>SVN</code> to a new Windows 8 machine, build and then run the app, it throws me:</p> <blockquote> <p>InvalidProgramException: Common Language Runtime detected an invalid program</p> </blockquote> <p>I rebuild the source codes and it runs well on all other three Windows 7 machines. I guess it does matter with Windows 8. I write the following small console application. I build the source code on Windows 8 and it does run well on Windows 7 but doesn't on Windows 8. So it's something about the runtime on Windows 8. It seems only something wrong with the enum type whose underlying type is not the default type, Int32. </p> <p>After googling, people say it's about JIT compiler but I still have no idea. I use VS 2010 targeted .NET 4.0 on both Windows 7 and Windows 8. Does any change about this in Windows 8? I'm reading the Source code of AutoMapper. I think it really something wrong with C# or CLI. Hope you give some clue. Thanks.</p> <pre><code>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&lt;PriorityModel, PriorityDto&gt;(); // OK Mapper.CreateMap&lt;PriorityModel2, PriorityDto2&gt;(); // [InvalidProgramException: Common Language Runtime detected an invalid program.] Mapper.CreateMap&lt;PriorityModel3, PriorityDto3&gt;(); // [InvalidProgramException: Common Language Runtime detected an invalid program.] Console.Read(); } } </code></pre> <p>exception stacktrace:</p> <pre><code>[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 </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload