我已经编写了一个可以在我的开发设备和Win 7/8/10虚拟机上正常运行的应用程序,但在其他每台计算机上都崩溃了(win 7/8/10)我试过了。启动应用程序时,几乎就像没有发生任何事情一样。
在事件查看器中,异常是XamlParseException。
事件查看器捕获了这个(我的设备和所有设备都得到v4.0.30319
,即使它们有.NET 4.5 +):
Application: HelpScoutMetrics.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Windows.Markup.XamlParseException
Stack:
at System.Windows.Markup.WpfXamlLoader.Load(System.Xaml.XamlReader, System.Xaml.IXamlObjectWriterFactory, Boolean, System.Object, System.Xaml.XamlObjectWriterSettings, System.Uri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(System.Xaml.XamlReader, Boolean, System.Object, System.Xaml.Permissions.XamlAccessLevel, System.Uri)
at System.Windows.Markup.XamlReader.LoadBaml(System.IO.Stream, System.Windows.Markup.ParserContext, System.Object, Boolean)
at System.Windows.Application.LoadComponent(System.Object, System.Uri)
at HelpScoutMetrics.MainWindow.InitializeComponent()
at HelpScoutMetrics.MainWindow..ctor()
at HelpScoutMetrics.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.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
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)
我在这里尝试了解决方案:.NET application cannot start and receive XamlParseException
我已经尝试注释掉我的起始代码,在App.xaml.cs
中OnStartup()
覆盖已将base.OnStartup()注释掉,唯一的代码是弹出消息框。该应用程序仍然崩溃。
我已尽最大努力验证输出文件夹中是否存在所有依赖项。
可能导致这种情况的原因是什么?我该怎么做才能获得有关异常的更多信息?什么代码在OnStartup()
之前运行,我可以尝试用处理程序包装?