2014-09-21 37 views
0

當我啓動應用程序時,有時(通常是編譯後第一次),顯示以下錯誤。
重新啓動應用程序可以最多次解決問題。
如何找出根本原因?在應用程序啓動時斷言失敗:ReflectionTypeLoad_LoadFailed

除了錯誤消息和堆棧跟蹤,我沒有其他有關原因的信息。
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) 

回答

0

在Catel的AssemblyHelper創建一個緩存,使反射儘可能快。這意味着它有時會嘗試加載無法加載的類型/程序集,但這些是第一次機會異常,因此可以安全地忽略。

+0

不幸的是我沒有機會忽略這個例外。它顯示在與其他例外截然不同的模式彈出對話框中。甚至沒有顯示具體的異常類型。那麼我該如何以及在哪裏可以忽略它?不管怎樣,不應該這樣做嗎? – 2014-09-22 09:10:57

+0

請在官方問題跟蹤器中提供repro,請參閱http://www.catelproject.com/support/issue-tracker – 2014-09-22 10:03:48