core icon indicating copy to clipboard operation
core copied to clipboard

SerializeToXml() throws an exception

Open Adler-lug opened this issue 1 year ago • 0 comments

using var new_stream = new FileInfo("f:\\Downloads\\east.osm").OpenRead();
OsmStreamSource new_map = new XmlOsmStreamSource(new_stream);
// Some actions
var osm = new_map.SerializeToXml();

I'm getting an exception:

System.InvalidOperationException: "To be XML serializable, types which inherit from IEnumerable must have an implementation of Add(System.Object) at all levels of their inheritance hierarchy. OsmSharp.Streams.OsmStreamSource does not implement Add(System.Object)."

Screenshot

How to fix it?

Or is there another way to save the edited osm file?

Adler-lug avatar Oct 28 '23 07:10 Adler-lug