关于 CLR 内核异常----COR_E_NEWER_RUNTIME(0x8013101B)

简介

COR_E_NEWER_RUNTIME,值为0x8013101B,代表的意思是"程序集是由比当前加载的运行时新的运行时生成的,因此无法加载。".它定义在cli-2.0-masterclrsrcinccorerror.h文件里,如下:

#define COR_E_NEWER_RUNTIME             EMAKEHR(0x101B)     // The assembly is built by a runtime newer than the currently loaded runtime, and cannot be loaded.

详细说明

当我们遇到这个错误时,比如您的[ComVisible]类无法加载,因为它依赖于CLR版本4。而且程序已经加载了CLR,很可能是版本2,因为另一个[ComVisible]类首先请求。它要求版本2。你需要一个app.exe.config文件来强制加载CLR版本4,即使有人要求版本2。应该是这样的:

<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>
</configuration>

也可能您的程序依赖更高版本的CLR,而机器上只有低版本的CLR。这时只需要安装高版本CLR就可以。

异常结构填充

ExceptionAddress: 76ebc5af (KERNELBASE!RaiseException+0x00000058)
ExceptionCode: e0434f4d (CLR exception)
ExceptionFlags: 00000001
NumberParameters: 1
Parameter[0]: 8013101b

原文地址:https://www.cnblogs.com/yilang/p/12425794.html