我正在用一些应该简单的单型代码苦苦挣扎,但引起了意外的例外。当我尝试在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);

Xmlelement friendelement = HandXmlDocument.Createelement(“ friend”);

friendelement.setAttribute(“ locationx”,“ 35”);

friendelement.setAttribute(“ locationy”,“ 46”);

friendelement.setAttribute(“电话”,“ 4085556803”);

root.appendchild(friendelement);

xmlnodelist friendnodelist = handxmldocument.SelectNodes(“/friendlist/friend”);

这是一个例外:

E/mono ( 365): [0x45eec0:] EXCEPTION handling: System.TypeInitializationException: An exception was thrown by the type initializer for System.Console E/FriendsView( 365): Exception parsing XML document: An exception was thrown by the type initializer用于system.console e/friendsview(365):内部异常解析xml文档:system.executionEngineException:sigill e/friendsview(365):在system.console..console..cctor..cctor()[0x00019] In/users/plasma/plasma/polasma/prows/work/work/work/work/work/work/work/work/mono -Android-trunk/MCS/Class/Corlib/System/Console.CS:127

我不知道为什么在这里涉及System.Console!感谢您的帮助,马丁

有帮助吗?

解决方案

只需添加它,希望它可以帮助其他人遇到相同问题的人。事实证明,这是monodroid 1.0.8980中的一个错误,该错误是在monodroid 1.0.9186时固定的。升级到新版本解决了我的问题。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top