Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/282.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/150.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# System.Windows.Markup.XamlParseException';是否在PresentationFramework.dll中发生?_C#_C++_Wpf_Xamlparseexception - Fatal编程技术网

C# System.Windows.Markup.XamlParseException';是否在PresentationFramework.dll中发生?

C# System.Windows.Markup.XamlParseException';是否在PresentationFramework.dll中发生?,c#,c++,wpf,xamlparseexception,C#,C++,Wpf,Xamlparseexception,我在C#上使用WPF,代码如下 <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://s

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

<Window       
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
    xmlns:utility="clr-namespace:DVRClientInterface.Utility"
    xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"     
    xmlns:wpftoolkit="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"   
    xmlns:customControl="clr-namespace:DVRClientInterface.CustomControls"    
    x:Class="DVRClientInterface.MainWindow"
    WindowStyle="None" ResizeMode="CanMinimize"
    AllowsTransparency="True"
    WindowState = "Maximized"
    WindowStartupLocation="CenterScreen"    
    StateChanged="Window_StateChanged" 
    KeyUp="Window_KeyUp" 
    KeyDown="Window_KeyDown"    
    Closing="Window_Closing" Loaded="Window_Loaded"
     >
    <!-- WindowState = "Maximized" -->
    <Window.Background>
        <ImageBrush ImageSource="Resources\main_background.png"/>
    </Window.Background>

    <Grid x:Name="MainWindowGrid">
     //My GUI Code here

    </Grid>
</Window>
第9行是
xmlns:customControl=“clr命名空间:DVRClientInterface.CustomControls”

但我不知道为什么,在此之前,XAML仍然可以正常工作。我只是编辑C++项目中的代码,然后它总是抛出那个异常。 很多话题都说这是由projects配置引起的,但我不知道projects配置中的什么地方会引发这个异常

有人能给我建议怎么修吗

更新:输出调试如下所示

'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
的实例,您的构造函数引发了异常

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

例如,如果在窗口的构造函数中连接到数据库,并且由于某种原因数据库不可用,则内部异常可能是
TimeoutException
SqlException
或数据库代码引发的任何其他异常


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

问题已解决!我使用Ctrl+Alt+E打开异常窗口,并选中了所有抛出复选框。因此,调试程序可以准确地在错误代码处停止。

更新:这不是解决方案,但它是可能导致问题中出现异常的问题的解决方法


我已经解决了从发布配置到调试配置的更改问题。

我在使用“所有cpu”目标构建应用程序时遇到了这个问题,而应用程序引用了仅限第三方x64(托管)dll。

我花了很长时间才解决这个问题,因此为了搜索者的利益:

我遇到了一个奇怪的问题,应用程序在debug中工作,但发布后给出了
XamlParseException

在修复了Katjoek详述的x86/x64问题后,问题仍然存在

问题是,CEF的一个教程说要从NuGet中删除
System.Windows.Interactivity
(尽管它在.NET的参考资料的扩展部分中),并从NuGet集合
特定版本
删除到
true

一旦部署,不同版本的
System.Windows.Interactivity
将由不同的应用程序打包


它拒绝使用不同版本的dll导致整个应用程序崩溃,出现了
XamlParseException

当我遇到这个问题时,我几乎忘记在代码的XAML中填充参数值


但是由于某种原因,异常会将我发送到WPF程序的CS,而不是XAML。不知道为什么。

在我的例子中,当我同时访问两个动态创建的控件(combobox)时,这个错误出现了,这两个控件都是从另一个类创建的

//dynamic created controls
ComboBox combobox1 = ManagerControls.myCombobox1;
...some events

ComboBox combobox2 = ManagerControl.myComboBox2;
...some events

//构造函数中的方法
public static void InitializeDynamicControls()
{
ComboBox cb=新ComboBox();
cb.Background=新的SolidColorBrush(Colors.Blue);
...
cb.宽度=100;
cb.Text=“选择窗口”;
ManagerControls.mycombox1=cb;

ManagerControls.mycombox2=cb;//您应该检查“xmlns:utility=“clr namespace:DVRClientInterface.utility”和“xmlns:customControl=“clr namespace:DVRClientInterface.CustomControls”,似乎另一个还可以。我尝试删除CustomControls和其他控件,但此异常仍然发生。在此之前,它仍然可以正常工作:(我已经在我的帖子中添加了调试输出,您能阅读它以了解更多信息吗?谢谢!谢谢您的帮助,但是当我将断点放入DVRClientInterface.MainWindow()中时)函数,它甚至没有到达这个断点,我想它在调用这个构造函数之前崩溃了。如何获取内部异常?我已经在我的帖子中添加了调试输出,您可以阅读它以了解更多信息。谢谢!您如何看到这个窗口?我在调试时运行成功,但在发布时也失败了,我使用Ctrl-Alt E-answer-check-all并找到place如果出现异常,那么我就知道问题出在哪里了。我使用了一些存在于调试文件夹中但不存在于发布文件夹中的文件。更改配置不是解决方案。它可能会给出错误或缺失的信息,如@yuyangJian所说
//dynamic created controls
ComboBox combobox1 = ManagerControls.myCombobox1;
...some events

ComboBox combobox2 = ManagerControl.myComboBox2;
...some events
//method in constructor
public static void InitializeDynamicControls()
{
     ComboBox cb = new ComboBox();
     cb.Background = new SolidColorBrush(Colors.Blue);
     ...
     cb.Width = 100;
     cb.Text = "Select window";
        
     ManagerControls.myCombobox1 = cb;
     ManagerControls.myComboBox2 = cb; // <-- error here
}