WPF类加载错误?在添加自定义类时崩溃



弹出

An unhandled exception of type 'System.IO.IOException' occurred in
PresentationFramework.dll
Additional information: Cannot locate resource 'mainwindow.xaml'.

输出日志

'markless.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:WindowsMicrosoft.NetassemblyGAC_32mscorlibv4.0_4.0.0.0__b77a5c561934e089mscorlib.dll'
...
'markless.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:WindowsMicrosoft.NetassemblyGAC_MSILPresentationFrameworkv4.0_4.0.0.0__31bf3856ad364e35PresentationFramework.dll'
The thread 'vshost.NotifyLoad' (0x6b0) has exited with code 0 (0x0).
The thread 'vshost.LoadReference' (0x1fa8) has exited with code 0 (0x0).
'markless.vshost.exe' (Managed (v4.0.30319)): Loaded 'T:#_ProgrammingGitHubmarklesssrcwin2marklessbinDebugmarkless.exe', Symbols loaded.
Step into: Stepping over method without symbols 'markless.App.App'
'markless.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Configurationv4.0_4.0.0.0__b03f5f7f11d50a3aSystem.Configuration.dll'
A first chance exception of type 'System.IO.IOException' occurred in PresentationFramework.dll
An unhandled exception of type 'System.IO.IOException' occurred in PresentationFramework.dll
Additional information: Cannot locate resource 'mainwindow.xaml'.
The program '[6268] markless.vshost.exe: Program Trace' has exited with code 0 (0x0).
The program '[6268] markless.vshost.exe: Managed (v4.0.30319)' has exited with code 0 (0x0).

每当我尝试将C#类添加到我的项目中时,就会发生这种情况。它是WPF,当我开始一个新项目时,它会很好地运行,只有窗口。当我尝试为应用程序添加实际功能的那一刻,它就这样爆发了。(哦,它构建,它构建得很公平-这是一个运行时错误。)即使我删除了这个类,应用程序仍然无法正确运行。做什么?

感谢您的帮助。

前进的方法有很多,但只有一种方法可以停滞不前FDR-

编辑:如果你想查看回购,它就在这里。

附加信息:找不到资源"mainwindow.xaml".

您的App.xaml:

<Application x:Class="markless.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">

问题不在于添加任何类,而在于删除/重命名此处仍引用的MainWindow

最新更新