简体   繁体   English

WPF桌面应用程序将无法在Windows 10中启动

[英]WPF Desktop Application Will not start in Windows 10

I wrote a WPF C# application in visual studio 2010, but it will not start up on my Windows 10 Machine. 我在Visual Studio 2010中编写了WPF C#应用程序,但无法在Windows 10计算机上启动。 I ran into this issue a while back on a different computer, and installing Direct X 9 fixed my issue, this time it did not. 我曾在另一台计算机上遇到此问题,安装Direct X 9修复了我的问题,但这次没有。 I tried compatibility mode, no luck. 我尝试了兼容模式,没有运气。 I also tried adding some exception handling to the initialization of the program like I've read on some other posts here, but it does not seem to even make it to that point when I start the app. 我还尝试向程序的初始化中添加一些异常处理,就像我在这里的其他文章中所读到的那样,但是当我启动该应用程序时,似乎还没有做到这一点。 This is what I do for that, I get no pop ups at all: 这就是我要做的,我完全没有弹出窗口:

        protected override void OnInitialized(EventArgs e)
    {
        MessageBox.Show("OnInitialized");
        // hook on error before app really starts
        base.OnInitialized(e);
    }

    public override void BeginInit()
    {
        MessageBox.Show("BeginInit");
        AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
        Application.Current.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(Current_DispatcherUnhandledException);

        base.BeginInit();
    }

    protected override void OnSourceInitialized(EventArgs e)
    {
        MessageBox.Show("OnSourceInitialized");

        base.OnSourceInitialized(e);
    }

    void Current_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
    {
        MessageBox.Show(e.Exception.Message);
    }

    void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
    {
        // put your tracing or logging code here (I put a message box as an example)
        MessageBox.Show(e.ExceptionObject.ToString());
    }

When I look in the event viewer, I get two errors an Application Error: 当我查看事件查看器时,出现两个错误,一个应用程序错误:

Faulting application name: BuildingManagerWPF.exe, version: 1.0.0.0, time stamp: 0x59e6d248 Faulting module name: KERNELBASE.dll, version: 10.0.14393.479, time stamp: 0x58256d37 Exception code: 0xe0434352 Fault offset: 0x000da832 Faulting process id: 0x218 Faulting application start time: 0x01d347c8387ca8a0 Faulting application path: C:\\Users\\lattepanda\\Desktop\\Building\\BuildingManagerWPF.exe Faulting module path: C:\\WINDOWS\\System32\\KERNELBASE.dll Report Id: 08f61ca3-5455-4f5c-98df-1195f203d482 Faulting package full name: Faulting package-relative application ID: 错误的应用程序名称:BuildingManagerWPF.exe,版本:1.0.0.0,时间戳:0x59e6d248错误的模块名称:KERNELBASE.dll,版本:10.0.14393.479,时间戳:0x58256d37异常代码:0xe0434352错误偏移量:0x000da832错误进程ID:0x218错误应用程序开始时间:0x01d347c8387ca8a0错误的应用程序路径:C:\\ Users \\ lattepanda \\ Desktop \\ Building \\ BuildingManagerWPF.exe错误的模块路径:C:\\ WINDOWS \\ System32 \\ KERNELBASE.dll报告ID:08f61ca3-5455-4f5c-98df-1195f203d482错误软件包全名:与软件包相关的应用程序ID错误:

And a .NET Runtime Error: .NET运行时错误:

Application: BuildingManagerWPF.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. 应用程序:BuildingManagerWPF.exe框架版本:v4.0.30319说明:由于未处理的异常,进程已终止。 Exception Info: System.IO.FileNotFoundException at BuildingManagerWPF.MainWindow..ctor() 异常信息:BuildingManagerWPF.MainWindow..ctor()处的System.IO.FileNotFoundException

Exception Info: System.Windows.Markup.XamlParseException 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.LoadBamlStreamWithSyncInfo(System.IO.Stream, System.Windows.Markup.ParserContext) at System.Windows.Application.LoadComponent(System.Uri, Boolean) at System.Windows.Application.DoStartup() at System.Windows.Application.<.ctor>b__1_0(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, 异常信息:System.Windows.Markup.WpfXamlLoader.Load处的System.Windows.Markup.XamlParseException System.Windows.Markup.XamlReader.LoadBaml(System.IO.Stream)上的System.Windows.Markup.WpfXamlLoader.LoadBaml(System.Xaml.XamlReader,Boolean,System.Object,System.Xaml.Permissions.XamlAccessLevel,System.Uri) ,System.Windows.Application.LoadBamlStreamWithSyncInfo(System.IO.Stream,System.Windows.Markup.ParserContext),System.Windows.Application.LoadComponent(System.Uri)处的System.Windows.Markup.ParserContext,System.Object,Boolean) ,Boolean)在System.Windows.Application.DoStartup()在System.Windows.Application。<。ctor> b__1_0(System.Object)在System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate,System.Object,Int32 )在System.Windows.Threading.ExceptionWrapper.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 MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, 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 System.Windows.Threading.DispatcherOperation.InvokeImpl()处的System.Delegate)System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext,System.Threading.System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)在System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Object,Boolean)))的ContextCallback,System.Object,Boolean) MS.Internal.CulturePreservingExecutionContext.Run(System.Windows.Threading.DispatcherOperation.Invoke()处的System.Threading.ContextCallback,System.Object).MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext,System.Threading.ContextCallback,System.Object) System.Windows.Threading.Dispatcher.WndProcHook(IntPtr,Int32,IntPtr,IntPtr,Boolean ByRef)处的Windows.Threading.Dispatcher.ProcessQueue()在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 System.Windows.Threading.ExceptionWrapper.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) ),位于System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate,System.Object,Int32)的MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object),位于System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, MS的System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority,System.TimeSpan,System.Delegate,System.Object,Int32)中的System.Delegate,System.Object,Int32,System.Delegate)。 Win32.HwndSubclass.SubclassWndProc(IntPtr,Int32,IntPtr,IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame) at System.Windows.Application.RunDispatcher(System.Object) at System.Windows.Application.RunInternal(System.Windows.Window) at System.Windows.Application.Run(System.Windows.Window) at System.Windows.Application.Run() at BuildingManagerWPF.App.Main() 在MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)在System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)在System.Windows.Threading.Dispatcher.PushFrame(System。 Windows的System.Windows.Application.RunDispatcher(System.Object)的Windows.Threading.DispatcherFrame)的System.Windows.Application.Run(System.Windows.Window)的System.Windows.Application.RunInternal(System.Windows.Window)的BuildingManagerWPF.App.Main()上的System.Windows.Application.Run()

If your Visual Studio 2010 isn't updated to SP1 then please try that to begin with: Update for Microsoft Visual Studio 2010 Service Pack 1 (KB2736182) 如果您的Visual Studio 2010未更新为SP1,请尝试从以下步骤开始: Microsoft Visual Studio 2010 Service Pack 1更新(KB2736182)

But perhaps you should consider updating the visual studio version to a newer one...? 但是也许您应该考虑将Visual Studio版本更新为更新的版本?? Visual Studio Downloads Visual Studio下载

Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM