在PresentationFramework.dll中发生了System.Windows.Markup.XamlParseException?

我在C#上使用WPF作为代码如下

      //My GUI Code here   

当我运行应用程序时,它将抛出以下exception

 An unhandled exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll Additional information: 'The invocation of the constructor on type 'DVRClientInterface.MainWindow' that matches the specified binding constraints threw an exception.' Line number '9' and line position '5'. If there is a handler for this exception, the program may be safely continued. 

第9行是xmlns:customControl="clr-namespace:DVRClientInterface.CustomControls"

但我不知道为什么,在此之前XAML仍然可以正常工作。 我只是编辑C ++项目中的代码,然后它总是抛出exception。

许多主题说它是由项目配置引起的,但我不知道在我的项目配置中引发了这个exception。

有人可以建议我如何解决它?

更新:输出调试如下

 'MysticClient.exe': Loaded 'E:\TIN HOC\Learning\Chuong Tring Dao Tao\Working\Main_Code\SecurityLabCode\DVRClient\Bin\x86\Debug\MysticClient.exe', No native symbols in symbol file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\mscoree.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscoreei.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\msvcr110_clr0400.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\51e2934144ba15628ba5a31be2dae7dc\mscorlib.ni.dll', Cannot find or open the PDB file. 'MysticClient.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file. 'MysticClient.exe' (Managed (v4.0.30319)): Loaded 'E:\TIN HOC\Learning\Chuong Tring Dao Tao\Working\Main_Code\SecurityLabCode\DVRClient\Bin\x86\Debug\MysticClient.exe', Symbols loaded. 'MysticClient.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System\e40da7a49f8c3f0108e7c835b342f382\System.ni.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\WindowsBase\cd235caf797fb017f140016be88f33b7\WindowsBase.ni.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\cryptsp.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\rsaenh.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\PresentationCore\b52bc540630c3aa5de542c382af35c20\PresentationCore.ni.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\Presentatio5ae0f00f#\97e6b67983d07a066b68b3ae8be2f53d\PresentationFramework.ni.dll', Cannot find or open the PDB file. 'MysticClient.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'MysticClient.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\WindowsBase\v4.0_4.0.0.0__31bf3856ad364e35\WindowsBase.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'MysticClient.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'MysticClient.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\PresentationCore\v4.0_4.0.0.0__31bf3856ad364e35\PresentationCore.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'MysticClient.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Xaml\cc4d9093563dadee370788bbc3ecf4fb\System.Xaml.ni.dll', Cannot find or open the PDB file. 'MysticClient.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xaml\v4.0_4.0.0.0__b77a5c561934e089\System.Xaml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\DWrite.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF\wpfgfx_v0400.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF\PresentationNative_v0400.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\clrjit.dll', Cannot find or open the PDB file. Step into: Stepping over non-user code 'DVRClientInterface.App.App' 'MysticClient.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\nlssorting.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Configuration\28586400bcaf94c13a9fd0dff4a1e090\System.Configuration.ni.dll', Cannot find or open the PDB file. 'MysticClient.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'MysticClient.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Xml\9ba07396ae369d010c5c3927a82ef426\System.Xml.ni.dll', Cannot find or open the PDB file. 'MysticClient.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file. Step into: Stepping over non-user code 'DVRClientInterface.App.InitializeComponent' 'MysticClient.exe': Loaded 'E:\TIN HOC\Learning\Chuong Tring Dao Tao\Working\Main_Code\SecurityLabCode\DVRClient\Bin\x86\Debug\CPPWrapper.dll', Symbols loaded. 'MysticClient.exe': Unloaded 'E:\TIN HOC\Learning\Chuong Tring Dao Tao\Working\Main_Code\SecurityLabCode\DVRClient\Bin\x86\Debug\CPPWrapper.dll' 'MysticClient.exe': Loaded 'E:\TIN HOC\Learning\Chuong Tring Dao Tao\Working\Main_Code\SecurityLabCode\DVRClient\Bin\x86\Debug\CPPWrapper.dll', Symbols loaded. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\RpcRtRemote.dll', Cannot find or open the PDB file. 'MysticClient.exe': Unloaded 'E:\TIN HOC\Learning\Chuong Tring Dao Tao\Working\Main_Code\SecurityLabCode\DVRClient\Bin\x86\Debug\CPPWrapper.dll' 'MysticClient.exe': Loaded 'E:\TIN HOC\Learning\Chuong Tring Dao Tao\Working\Main_Code\SecurityLabCode\DVRClient\Bin\x86\Debug\CPPWrapper.dll', Symbols loaded. 'MysticClient.exe': Loaded 'E:\TIN HOC\Learning\Chuong Tring Dao Tao\Working\Main_Code\SecurityLabCode\DVRClient\Bin\x86\Debug\Common.dll', Symbols loaded. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\IPHLPAPI.DLL', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\nsi.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\winnsi.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\msvcr110d.dll', Symbols loaded. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\msvcp110d.dll', Symbols loaded. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\ws2_32.dll', Cannot find or open the PDB file. 'MysticClient.exe': Loaded 'E:\TIN HOC\Learning\Chuong Tring Dao Tao\Working\Main_Code\SecurityLabCode\DVRClient\Bin\x86\Debug\DVRClientCore.dll', Symbols loaded. 'MysticClient.exe': Loaded 'E:\TIN HOC\Learning\Chuong Tring Dao Tao\Working\Main_Code\SecurityLabCode\DVRClient\Bin\x86\Debug\ClientCommunication.dll', Symbols loaded. First-chance exception at 0x7757b499 in MysticClient.exe: 0xC0000005: Access violation writing location 0x00000014. 'MysticClient.exe': Unloaded 'E:\TIN HOC\Learning\Chuong Tring Dao Tao\Working\Main_Code\SecurityLabCode\DVRClient\Bin\x86\Debug\CPPWrapper.dll' 'MysticClient.exe': Unloaded 'E:\TIN HOC\Learning\Chuong Tring Dao Tao\Working\Main_Code\SecurityLabCode\DVRClient\Bin\x86\Debug\DVRClientCore.dll' 'MysticClient.exe': Unloaded 'E:\TIN HOC\Learning\Chuong Tring Dao Tao\Working\Main_Code\SecurityLabCode\DVRClient\Bin\x86\Debug\ClientCommunication.dll' 'MysticClient.exe': Unloaded 'E:\TIN HOC\Learning\Chuong Tring Dao Tao\Working\Main_Code\SecurityLabCode\DVRClient\Bin\x86\Debug\Common.dll' 'MysticClient.exe': Unloaded 'C:\Windows\SysWOW64\ws2_32.dll' 'MysticClient.exe': Unloaded 'C:\Windows\SysWOW64\msvcp110d.dll' 'MysticClient.exe': Unloaded 'C:\Windows\SysWOW64\msvcr110d.dll' 'MysticClient.exe': Unloaded 'C:\Windows\SysWOW64\IPHLPAPI.DLL' 'MysticClient.exe': Unloaded 'C:\Windows\SysWOW64\winnsi.dll' 'MysticClient.exe': Unloaded 'C:\Windows\SysWOW64\nsi.dll' First-chance exception at 0x74e8b9bc in MysticClient.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x00a7ab9c. First-chance exception at 0x74e8b9bc in MysticClient.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000. First-chance exception at 0x74e8b9bc in MysticClient.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000. First-chance exception at 0x74e8b9bc in MysticClient.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000. First-chance exception at 0x74e8b9bc in MysticClient.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000. First-chance exception at 0x74e8b9bc in MysticClient.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000. First-chance exception at 0x74e8b9bc in MysticClient.exe: Microsoft C++ exception: Exception at memory location 0x00a7cae4. First-chance exception at 0x74e8b9bc in MysticClient.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000. First-chance exception at 0x74e8b9bc in MysticClient.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000. First-chance exception at 0x74e8b9bc in MysticClient.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000. 'MysticClient.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Cannot find or open the PDB file. An unhandled exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll Additional information: 'The invocation of the constructor on type 'DVRClientInterface.MainWindow' that matches the specified binding constraints threw an exception.' Line number '9' and line position '5'. The program '[5664] MysticClient.exe: Native' has exited with code -1 (0xffffffff). The program '[5664] MysticClient.exe: Managed (v4.0.30319)' has exited with code -1 (0xffffffff). 

非常感谢!

T&T

这不是XAML的问题。 错误消息说它试图创建DVRClientInterface.MainWindow的实例,并且您的构造函数引发了exception。

您需要查看“内部exception”属性以确定根本原因。 它可能完全是任何东西,但应该提供方向。

Visual Studio中显示的内部异常的示例

例如,如果要在窗口的构造函数中连接到数据库,并且由于某种原因该数据库不可用,则内部exception可能是TimeoutExceptionSqlException或数据库代码抛出的任何其他exception。

如果要在静态构造函数中抛出exception,则可以从MainWindow引用的任何类生成exception。 如果任何MainWindow字段正在调用可能抛出的方法,则也会运行类初始值设定项。

问题解决了! 我正在使用Ctrl + Alt + E打开exception窗口,我检查了所有throw复选框。 因此,debuger可以完全停止错误代码。

我已经解决了从Release Configuration到Debug Configuration的问题。

当我使用“所有cpu”目标构建我的应用程序时,我有这个,而它引用了第三方x64(托管)dll。