当我试图运行我的项目时,我得到了这个异常。我没有更改任何代码。
引发的异常:System.Xaml.dll中的“MS.Internal.Xaml.Parser.GenericTypeNameParser.TypeNameParserException”
附加信息:前缀“Custom”不Map到命名空间。
“自定义”指的是App.xaml中的MAHapps metro工具包:
<Application 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:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Custom="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:Custom1="http://metro.mahapps.com/winfx/xaml/shared"
字符串
我不知道为什么这会突然改变。我更新了VS2015到最新版本,它仍然不工作。
UPDATE:我把InitializeComponent()调用放在一个try catch中,试图获取异常对象,现在异常没有被抛出。
try
{
InitializeComponent();
}
catch (Exception ex)
{
MessageBox.Show(ex.InnerException.Message);
}
型
更新2:它仍然抛出异常,但“catch(Exception ex)”由于某种原因忽略了TypeNameParserException。
3条答案
按热度按时间bq9c1y661#
完全卸载并重新安装VS 2015解决了这个问题。
yvfmudvl2#
我的猜测是,异常是在WPF的XAML处理中的某个地方被捕获的。所以这就是为什么你不能捕获异常。你遇到的问题来自Visual Studio的设置。这里你可以告诉当异常发生时该怎么做。(自VS 2015以来,有一个特殊的窗口用于控制. Windows ->异常设置)如果在该异常中有一个标记,Visual Studio将停止并显示异常,即使它不会在常规操作中显示。您可以尝试通过标记所有异常以显示来恢复问题。
eh57zj3b3#
我在VS 2022中的WPF.NET解决方案中遇到了这个问题。我最近关闭了“仅启用我的代码”以在
Release
配置中进行调试。当我切换回Debug
配置时,我注意到这些错误。我不得不重新打开“仅启用我的代码”以停止接收此错误。
的数据