在应用程序启动时断言失败:ReflectionTypeLoad_LoadFailed

时间:2014-09-21 13:25:27

标签: catel

当我启动应用程序时,有时(大部分是在编译后第一次),会显示以下错误 重新启动应用程序大多数时间都可以解决问题 我怎样才能找出根本原因?

除了错误消息和堆栈跟踪之外,我没有关于原因的其他信息 Visual Studio告诉我调试的源信息不可用 从线程信息窗口我可以看到主线程在Catel.Reflection.ReflectionExtensions.GetTypesEx()。

ApplicationName.vshost.exe - 断言失败
表达式: [mscorlib递归资源查找错误]
描述: mscorlib中资源查找期间的无限递归 这可能是mscorlib中的错误,也可能是某些可扩展点,例如程序集解析事件或CultureInfo名称。
资源名称: ReflectionTypeLoad_LoadFailed

完整的堆栈跟踪可用in my onedrive 以下是前几行:

Stack Trace:
at System.Environment.ResourceHelper.GetResourceStringCode(Object userDataln)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Environment.ResourceHelper.GetResourceString(String key, CultureInfo culture)
at System.Environment.ResourceHelper.GetResourceString(String key)
at System.Environment.GetResourceStringLocal(String key)
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.ReflectionAssembly.GetTypes()
at Catel.Reflection.ReflectionExtensions.GetTypesEx(Assembly assembly) in c:\CIWSMA1596\Source\Catel\sraCatel.Core\Catel.CoreShareaReflection\Extensions\ReflectionExtensions.assembly.cs:line 33
at Catel.Reflection.AssemblyHelper.GetAllTypesSafely(Assembly assembly, Boolean logLoaderExceptions) in cACI_WS\WA1596\Source\Catel sraCatel.Core\Catel.Core.ShareaReflection\Helpers `, AssemblyHelper.cs:line 192
at Catel.Reflection.TypeCachelnitializeAssemblies(lEnumerablel assemblies) in cACI_WSWW\1596\Source\Catel\src\Catel.CoreKatel.Core.ShareaReflection\TypeCache.cs:line 583
at Catel.Reflection.TypeCachelnitializeTypes(Boolean forceFulllnitialization, Assembly assembly) in cACI_WSNWs\1596\Source\cateNsraCatel.Core\Catel.Core.ShareaReflection\TypeCache.cs:line 553
at Catel.Reflection.TypeCache.OnAssemblyLoaded(Object sender, AssemblyLoadEventArgs args) in c:\CI_WSNWs\1596\SourceKateNsraCatel.Core\Catel.Core.ShareaReflection\TypeCache.cs:line 131
at System.AssemblyLoadEventHandlerinvoke(Object sender, AssemblyLoadEventArgs args)
at SystemAppDomain.OnAssemblyLoadEvent(RuntimeAssembly LoadedAssembly)
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at Catel.Reflection.ReflectionExtensions.GetTypesEx(Assembly assembly) in c:\CIWS\Ws\1596\Source\Catel\src\Catel.Core\Catel.Core.Shared\Reflection\Extensions\ReflectionExtensions.assembly.cs:line 33
at Catel.ReflectionAssemblyHelper.GetAllTypesSafely(Assembly assembly, Boolean logLoaderExceptions) in c:\CI_WSNWs\1596\Source\catel\sraCatel.Core\Catel.Core.ShareaReflection\Helpers‘AssemblyHelper.cs:line 192
at Catel.Reflection.TypeCachelnitializeAssemblies(lEnumerablel assemblies) in cACI_WSNWs\1596\SourceKatel\src\Catel.Core\Catel.Core.ShareaReflection TypeCache.cs:line 583
at Catel.Reflection.TypeCachelnitializeTypes(Boolean forceFulllnitialization, Assembly assembly) in c:\CIWS\Ws\1596\Source\Catel\sraCatel.Core\Catel.Core.ShareaReflection\TypeCache.cs:line 553
at Catel.Reflection.TypeCache.OnAssemblyLoaded(Object sender, AssemblyLoadEventArgs args) in c:\CI__WS\WA1596\Source\Catel\sraCatel.Core\Catel.Core.ShareaReflection\TypeCache.cs:line 131
at System.AssemblyLoadEventHandlerinvoke(Object sender, AssemblyLoadEventArgs args)
at System.AppDomain.OnAssemblyLoadEvent(RuntimeAssembly LoadedAssembly)
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at Catel.Reflection.ReflectionExtensions.GetTypesEx(Assembly assembly) in c: CIWSNWs\1596\Source\Catel\src Catel.Core\Catel.Core.ShareaReflection Extensions\ReflectionExtensions.assembly.cs:line 33
at Catel.Reflection.AssemblyHelper.GetAllTypesSafely(Assembly assembly, Boolean logLoaderExceptions) in c:\CI_WSNWs\1596\Source\Catel sraCatel.Core\Catel.Core.ShareaReflection\Helpers\AssemblyHelper.cs:line 192
at Catel.Reflection.TypeCacheinitializeAssemblies(lEnumerablel assemblies) in cACI_WS\WA1596\Source\Catel\src\Catel.CoreKatel.Core.ShareaReflection\TypeCache.cs:line 583
at Catel.Reflection.TypeCacheinitializeTypes(Boolean forceFulllnitialization, Assembly assembly) in cACIWS\WA1596\Source\Catel\sraCatel.Core\Catel.Core.ShareaReflection‘TypeCache.cs:line 553
at Catel.Reflection.TypeCache.OnAssemblyLoaded(Object sender, AssemblyLoadEventArgs args) in c:\CI__WS\Ws\1596\Source\Catel\sraCatel.Core\Catel.Core.ShareaReflection‘TypeCache.cs:line 131
at System.AssemblyLoadEventHandlerinvoke(Object sender, AssemblyLoadEventArgs args)
at System.AppDomain.OnAssemblyLoadEvent(RuntimeAssembly LoadedAssembly)

1 个答案:

答案 0 :(得分:0)

Catel中的AssemblyHelper创建了一个缓存,以尽可能快地进行反射。这意味着它有时会尝试加载无法加载的类型/程序集,但这些是第一次机会异常,因此可以安全地忽略。