MichaelFCoyle / SharpGPX

Read and write GPX
MIT License
6 stars 2 forks source link

Exception when trying to deserialize from file: System.InvalidOperationException: There is an error in XML document #9

Open johnjore opened 2 years ago

johnjore commented 2 years ago

Hm... something is not happy:

Exception when trying to deserialize from file: System.InvalidOperationException: There is an error in XML document. ---> System.InvalidOperationException: <ShapingPoint xmlns='http://www.garmin.com/xmlschemas/TripExtensions/v1'> was not expected
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot (System.Xml.Serialization.XmlTypeMapping rootMap) [0x0004f] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:182 
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot () [0x00022] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:87 
  at System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.Serialization.XmlSerializationReader reader) [0x00017] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs:369 
   --- End of inner exception stack trace ---
  at System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.Serialization.XmlSerializationReader reader) [0x00052] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs:379 
  at System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.XmlReader xmlReader) [0x00026] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs:358 
  at Utility.Serializer.Deserialize[T] (System.IO.TextReader reader, System.Type[] types, System.Xml.XmlReaderSettings settings) [0x0002b] in <f7fbc81366034ae9805dafa1da1c0dad>:0 

GPX file causing the issue. Export from Garmin Basecamp on Windows: You Yangs.txt

Assuming it's a problem with SharpGPX, but it could be me...

MichaelFCoyle commented 2 years ago

Hello! I just loaded the file using one of the tools under the Examples folder and it seems to work fine.

Looking at the stack trace I see that it seems to be using a Mono implementation of System.Xml, have you cloned the code into another project and linked it with Mono?

johnjore commented 2 years ago

Hi and I am using the SharpGPX NuGet package with a Xamarin.Android project, which uses Mono under the hood, I believe.

So the thinking is that it's not an issue with SharpGPX, but something with the System.XML implementation within Xamarin.Android that is unhappy with some part of the XML file?

MichaelFCoyle commented 2 years ago

I think it's something in Xamarin.Android, is there any way you can give me access to the project so I can see the code? It would be nice for SharpGPX to work with Xamarin

johnjore commented 2 years ago

Hi and yes, its all on https://github.com/johnjore/hajk, and the GPX file I imported should be in my first post. Note: I'm not a developer, so its a bit messy, but any issues, please reach out?


From: Michael Coyle @.***> Sent: 02 May 2022 07:29 To: MichaelFCoyle/SharpGPX Cc: John Jore; Author Subject: Re: [MichaelFCoyle/SharpGPX] Exception when trying to deserialize from file: System.InvalidOperationException: There is an error in XML document (Issue #9)

I think it's something in Xamarin.Android, is there any way you can give me access to the project so I can see the code? It would be nice for SharpGPX to work with Xamarin

— Reply to this email directly, view it on GitHubhttps://github.com/MichaelFCoyle/SharpGPX/issues/9#issuecomment-1114341341, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADC2CITCZB2DBVYJNYJAPM3VH3ZU5ANCNFSM5UYHVYUA. You are receiving this because you authored the thread.Message ID: @.***>

[ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/MichaelFCoyle/SharpGPX/issues/9#issuecomment-1114341341", "url": "https://github.com/MichaelFCoyle/SharpGPX/issues/9#issuecomment-1114341341", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.": "Organization", "name": "GitHub", "url": "https://github.com" } } ]