KeRNeLith / QuikGraph

Generic Graph Data Structures and Algorithms for .NET
https://kernelith.github.io/QuikGraph/
Microsoft Public License
453 stars 65 forks source link

[BUG] Unable to serialize using Xml or GraphML #87

Closed markphillips100 closed 1 month ago

markphillips100 commented 1 month ago

Describe the bug I have a graph of type UndirectedGraph<long, TaggedEdge<long, double>> that I am attempting to serialize. I'm using .NET 8. When serializing using either XML or GraphML both complain that serializing the EdgeEqualityComparer is not supported:

System.NotSupportedException: Serialization and deserialization of 'QuikGraph.EdgeEqualityComparer`1[[System.Int64, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' instances is not supported. The unsupported member type is located on type 'QuikGraph.EdgeEqualityComparer`1[System.Int64]'. Path: $.EdgeEqualityComparer.

Note I tried BinaryFormatter but .NET tells me that is no longer supported due to security vulnerabilites.

To Reproduce Steps to reproduce the behavior:

  1. Create an instance of UndirectedGraph<long, TaggedEdge<long, double>>
  2. Call SerializeToXml or SerializeToGraphMl.

Expected behavior Should serialize to file.

markphillips100 commented 1 month ago

Sorry, my fault. Seems I was not even calling the lib's extensions so it was just attempting to serialize without the help of this lib. It's serializing fine now.