【发布时间】:2011-06-13 19:22:48
【问题描述】:
我正在为一些应该很简单但导致意外异常的 Monodroid 代码苦苦挣扎。当我尝试在 XmlDocument 对象上调用 SelectNodes() 时,代码会引发异常。
这是代码:
XmlDocument handXmlDocument = new XmlDocument();
XmlDeclaration dec = handXmlDocument.CreateXmlDeclaration("1.0", null, null);
handXmlDocument.AppendChild(dec);
XmlElement root = handXmlDocument.CreateElement("friendslist");
handXmlDocument.AppendChild(root);
XmlElementfriendElement = handXmlDocument.CreateElement("friend");
friendElement.SetAttribute("locationx", "35");
friendElement.SetAttribute("locationy", "46");
friendElement.SetAttribute("电话", "4085556803");
root.AppendChild(friendElement);
XmlNodeListfriendNodeList = handXmlDocument.SelectNodes("/friendslist/friend");
这里是个例外:
E/mono (365): [0x45eec0:] 异常处理: System.TypeInitializationException: System.Console 的类型初始化程序抛出异常 E/FriendsView(365):解析 XML 文档的异常:System.Console 的类型初始化程序引发了异常 E/FriendsView(365):解析 XML 文档的内部异常:System.ExecutionEngineException:SIGILL E/FriendsView(365): 在 System.Console..cctor () [0x00019] 在 /Users/plasma/Work/mono-android-trunk/mcs/class/corlib/System/Console.cs:127
我不知道为什么 System.Console 在这里涉及!感谢您的帮助,马丁
【问题讨论】:
-
产品处于测试阶段,请在邮件列表或 Monodroid 错误跟踪器上报告错误。
标签: exception xmldocument xamarin.android selectnodes