C# 如何获取有关System.Xml.Xsl.XPath.XPathCompileException的更多信息
我有以下代码行:C# 如何获取有关System.Xml.Xsl.XPath.XPathCompileException的更多信息,c#,debugging,C#,Debugging,我有以下代码行: xslt.Load(XmlReader.Create(new StringReader(xslMarkup))); xslt属于xslcomiledtransfrom类型,xslMarkup是XDocument。 运行我的代码时,我在输出窗口中得到以下消息的许多行(代码一直运行到最后,但仍然给我这个异常): 所以我把代码行放在一个try-catch块中 try {xslt.Load(XmlReader.Create(new St
xslt.Load(XmlReader.Create(new StringReader(xslMarkup)));
xslt属于xslcomiledtransfrom类型,xslMarkup是XDocument
。
运行我的代码时,我在输出窗口中得到以下消息的许多行(代码一直运行到最后,但仍然给我这个异常):
所以我把代码行放在一个try-catch块中
try
{xslt.Load(XmlReader.Create(new StringReader(xslMarkup)));}
catch (Exception e)
{MessageBox.Show(e.Message);}
但是在编译期间,它不会进入catch块,而只是将异常抛出到输出窗口中
1. Can anyone help me understanding the error, I just stuck here and cannot find any help?
2. Any ideas how I can get more information about the error?
需要查看xml文件。很遗憾,我无法公开xml文件。但是,如果xml文件存在问题,是否有可能找出问题在文件中的位置?“但在编译过程中,它不会进入catch块”:它永远不会进入catch块,因为catch
是在运行时执行的,而不是在编译时执行的。您是否尝试过在调试器中运行它?VisualStudio应该弹出一个窗口,显示异常详细信息、潜在的内部异常等。从“项目”菜单中:添加新项,选择XML文件。然后将XML粘贴到windows中。错误将显示在错误视图上,就像其他编译器错误一样。需要查看xml文件。很遗憾,我无法将xml文件公开。但是,如果xml文件存在问题,是否有可能找出问题在文件中的位置?“但在编译过程中,它不会进入catch块”:它永远不会进入catch块,因为catch
是在运行时执行的,而不是在编译时执行的。您是否尝试过在调试器中运行它?VisualStudio应该弹出一个窗口,显示异常详细信息、潜在的内部异常等。从“项目”菜单中:添加新项,选择XML文件。然后将XML粘贴到windows中。错误将显示在错误视图上,就像在其他编译器错误中一样。
1. Can anyone help me understanding the error, I just stuck here and cannot find any help?
2. Any ideas how I can get more information about the error?