2017-01-11 13 views
1

私はXamarinでモバイルアプリケーションを開発しており、実行中にエラーが発生しています。
エラーは非常に頻繁に発生しますが、必ずしもそうではありません。
私はSumsung Galaxy S6でテストしています。モノ。 Xamarin。 svgイメージの読み込み中にエラーが発生しました。 System.MethodAccessException

(レンダラーにある)私が使用していたコード:

new SvgReader(new StreamReader(svgStream), 
       new StylesParser(new ValuesParser()), 
       new ValuesParser()); 

Xamarinバージョン:4.2.0.680

  • が7.0.0.18
  • をXamarin.Android

    • Xamarin

      例外:

      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 
      

      エラーを解決するにはどうすればよいですか?

    答えて

    2

    gfxエディタが入れているdoctypeとxmlnsの余計な部分をすべて削除するまで、私はMethod 'System.Xml.XmlReader:get_DtdInfo()' is inaccessibleの例外を無作為に続けていました。

    前に、私のSVGファイルが

    <?xml version="1.0" encoding="utf-8"?> 
    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ 
    <!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/"> 
    <!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/"> 
    <!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/"> 
    <!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/"> 
    <!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/"> 
    <!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/"> 
    <!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/"> 
    <!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">]> 
    <svg version="1.1" id="Layer_1" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" 
    xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve"> 
        <metadata> 
         <sfw xmlns="&ns_sfw;"> 
          <slices></slices> 
          <sliceSourceBounds width="427.66" height="361.922" x="42.17" y="-436.961" bottomLeftOrigin="true"></sliceSourceBounds> 
         </sfw> 
        </metadata> 
        <g> 
         ... 
    

    ...このように見えた。しかし、私は...

    <?xml version="1.0" encoding="utf-8"?> 
    <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve"> 
        <g> 
         ... 
    

    持って、ランダムなクラッシュが私のために去って行ったまで、私は見て不要なものをトリミング。複雑なdtd/xmlnsは、libを変質させなければなりません。

    +0

    ありがとうございました。 – nikelyn

    0

    悪いニュースは、これは以下のXamarinのはbugzillaの記事でカバーされるように表示されます。

    1. https://bugzilla.xamarin.com/show_bug.cgi?id=44134。 (の重複)
    2. https://bugzilla.xamarin.com/show_bug.cgi?id=41133

    は、ここでは、この例外のXamarinの説明です。今の

    https://developer.xamarin.com/api/type/System.MethodAccessException/

    、私は仕事の周りだけで例外をキャッチし、(悲しげに...を)上を移動するためにこれらのフォーラムで提案を実施し助言します。

    +0

    このバグはNEEDINFOとしてマークされています。つまり、顧客はまだ良いテストケースを提供できませんでした。 @nikelyn Xamarinチームに連絡して、テストするアプリを提供してください。回避策を講じないと、これは決して解決されません。 – ympostor

    関連する問題