Skip to content

Commit 2a8291d

Browse files
committed
Geometry converter no longer writes. It was causing a reference loop
1 parent 0b8d4bb commit 2a8291d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/GeoJSON.Net/Converters/GeometryConverter.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ namespace GeoJSON.Net.Converters
1515
/// </summary>
1616
public class GeometryConverter : JsonConverter
1717
{
18+
public override bool CanWrite => false;
19+
1820
/// <summary>
1921
/// Determines whether this instance can convert the specified object type.
2022
/// </summary>
@@ -64,7 +66,8 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
6466
/// <param name="serializer">The calling serializer.</param>
6567
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
6668
{
67-
serializer.Serialize(writer, value);
69+
// IGeometryObject can be written without a problem
70+
throw new NotImplementedException("Unnecessary because CanWrite is false. The type will skip the converter.");
6871
}
6972

7073
/// <summary>

0 commit comments

Comments
 (0)