我正在使用 Xamarin 开发一个移动应用程序,并在运行它时出现错误。
该错误经常发生,但并非总是如此。
我正在三星 Galaxy S6 上对其进行测试。
我正在使用的代码(位于渲染器中):
new SvgReader(new StreamReader(svgStream),
new StylesParser(new ValuesParser()),
new ValuesParser());
Xamarin 版本:
- Xamarin 4.2.0.680
- Xamarin.Android 7.0.0.18
例外:
ERROR: System.MethodAccessException: Method `System.Xml.Linq.XContainer:ReadContentFrom (System.Xml.XmlReader)' is inaccessible from method `System.Xml.XmlReader:get_DtdInfo ()'
at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_throw_method_access (intptr,intptr)
at System.Xml.Linq.XContainer.ReadContentFrom (System.Xml.XmlReader r) [0x001a0] in /Users/builder/data/lanes/3511/f4db8a57/source/mono/mcs/class/referencesource/System.Xml.Linq/System/Xml/Linq/XLinq.cs:3073
at System.Xml.Linq.XContainer.ReadContentFrom (System.Xml.XmlReader r, System.Xml.Linq.LoadOptions o) [0x00008] in /Users/builder/data/lanes/3511/f4db8a57/source/mono/mcs/class/referencesource/System.Xml.Linq/System/Xml/Linq/XLinq.cs:3090
at System.Xml.Linq.XDocument.Load (System.Xml.XmlReader reader, System.Xml.Linq.LoadOptions options) [0x0009b] in /Users/builder/data/lanes/3511/f4db8a57/source/mono/mcs/class/referencesource/System.Xml.Linq/System/Xml/Linq/XLinq.cs:5747
at System.Xml.Linq.XDocument.Load (System.IO.TextReader textReader, System.Xml.Linq.LoadOptions options) [0x0000f] in /Users/builder/data/lanes/3511/f4db8a57/source/mono/mcs/class/referencesource/System.Xml.Linq/System/Xml/Linq/XLinq.cs:5693
at System.Xml.Linq.XDocument.Load (System.IO.TextReader textReader) [0x00000] in /Users/builder/data/lanes/3511/f4db8a57/source/mono/mcs/class/referencesource/System.Xml.Linq/System/Xml/Linq/XLinq.cs:5666
at NGraphics.Custom.Parsers.SvgReader..ctor (System.IO.TextReader reader, NGraphics.Custom.Parsers.IStylesParser stylesParser, NGraphics.Custom.Parsers.IValuesParser valuesParser) [0x0001f] in <c787e3d8c9e842909bf317040008966c>:0
如何解决错误?