Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/313.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WPF应用程序启动时System.IO.FileLoadException的原因_C#_.net_Wpf_Debugging_Fileloadexception - Fatal编程技术网

C# WPF应用程序启动时System.IO.FileLoadException的原因

C# WPF应用程序启动时System.IO.FileLoadException的原因,c#,.net,wpf,debugging,fileloadexception,C#,.net,Wpf,Debugging,Fileloadexception,我正在调试一个WPF应用程序,该应用程序在启动时因未处理的System.IO.FileLoadException而崩溃。 我使用验证没有程序集加载错误,OnStartup覆盖中的所有代码都包装在一个try-catch中 排除了程序集绑定是异常的原因,我还应该研究哪些可能的原因? 以下是相关的事件日志条目: 源“ApplicationError”的第一个错误 源“.NET运行时”的第二个错误 应用程序:CompanyProductManager.exe 框架版本:v4.0.30319 描述:由

我正在调试一个WPF应用程序,该应用程序在启动时因未处理的System.IO.FileLoadException而崩溃。

我使用验证没有程序集加载错误,OnStartup覆盖中的所有代码都包装在一个try-catch中

排除了程序集绑定是异常的原因,我还应该研究哪些可能的原因?

以下是相关的事件日志条目:


源“ApplicationError”的第一个错误


源“.NET运行时”的第二个错误

应用程序:CompanyProductManager.exe
框架版本:v4.0.30319
描述:由于未处理的异常,进程已终止。
异常信息:System.IO.FileLoadException
堆栈:
在CompanySI.CompanyProduct.CompanyProductManager.App.OnStartup(System.Windows.StartupEventArgs)上
在System.Windows.Application.b__1(System.Object)中
位于System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate、System.Object、Int32)
位于MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object、System.Delegate、System.Object、Int32、System.Delegate)
在System.Windows.Threading.DispatcherOperation.InvokeImpl()中
位于System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object,布尔值)
在System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object,布尔值)
在System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object)上运行
在System.Windows.Threading.DispatcherOperation.Invoke()中
在System.Windows.Threading.Dispatcher.ProcessQueue()中
位于System.Windows.Threading.Dispatcher.WndProcHook(IntPtr、Int32、IntPtr、IntPtr、Boolean ByRef)
位于MS.Win32.hwndwapper.WndProc(IntPtr、Int32、IntPtr、IntPtr、Boolean ByRef)
位于MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
位于System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate、System.Object、Int32)
位于MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object、System.Delegate、System.Object、Int32、System.Delegate)
位于System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority,System.TimeSpan,System.Delegate,System.Object,Int32)
在MS.Win32.HwndSubclass.SubclassWndProc(IntPtr,Int32,IntPtr,IntPtr)
位于MS.Win32.unsafentivemethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
位于MS.Win32.unsafentivemethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
位于System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
位于System.Windows.Application.RunInternal(System.Windows.Window)
在System.Windows.Application.Run()处
在CompanySI.CompanyProduct.CompanyProductManager.App.Main()中

只是一个猜测,但我以前见过一个损坏的user.config文件在另一个应用程序中执行类似操作。那是很久以前的事了,我不记得抛出的异常是什么。检查AppData目录(或其他目录)中是否有延迟签名程序集并将其删除。

在未启用验证跳过的计算机上加载延迟签名程序集可能会导致类似错误。

谢谢,但这并没有解决问题。我遇到了与您的第一个“ApplicationError”类似的错误。下面沉默的音调的回答帮助我解决了我的问题。因此,我必须启用跳过验证,因为我的程序集只使用公钥签名,稍后会得到延迟签名。看起来与此类似。。而这个。。有损坏的硬盘或ssd?或者这个。。。。您是否从需要取消阻止的文件夹运行应用程序?您是否从网络文件夹运行应用程序?
Faulting application name: CompanyProductManager.exe, version: 4.2.0.0, time stamp: 0x514a20ba
Faulting module name: KERNELBASE.dll, version: 6.1.7601.18015, time stamp: 0x50b8479b
Exception code: 0xe0434352
Fault offset: 0x0000000000009e5d
Faulting process id: 0xf18
Faulting application start time: 0x01ce3c6ce70ee3f8
Faulting application path: C:\Users\My_User\AppData\Local\Apps\2.0\VJ12169A.3AG\6445EVK6.26Y\wmsd..tion_9fb3931a66281a0b_0004.0000_68586becb8f48f17\CompanyProductManager.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report Id: 2588c97b-a860-11e2-be7c-3cd92b4a0af4
Application: CompanyProductManager.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileLoadException
Stack:
   at CompanySI.CompanyProduct.CompanyProductManager.App.OnStartup(System.Windows.StartupEventArgs)
   at System.Windows.Application.<.ctor>b__1(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
   at System.Windows.Application.RunInternal(System.Windows.Window)
   at System.Windows.Application.Run()
   at CompanySI.CompanyProduct.CompanyProductManager.App.Main()