jezzsantos / automate

Templatize patterns from your own codebase, make them programmable, then share them with your team. https://jezzsantos.github.io/automate/
https://www.nuget.org/packages/automate
MIT License
7 stars 0 forks source link

Defect: Exporting test data from codetemplate test fails with JSON serialization error #53

Closed jezzsantos closed 2 years ago

jezzsantos commented 2 years ago

A command like: automate test codetemplate "Response" --aschildof "{RestApi.ServiceOperation}" --export-data "data.json" fails with exception:

Failed Unexpectedly, with: The exported test data could not be written to: 'C:\Projects\endgame\Boost\src\data.json, error was: 'A possible object cycle was detected. This can either be due
 to a cycle or if the object depth is larger than the maximum allowed depth of 64. Consider using ReferenceHandler.Preserve on JsonSerializerOptions to support cycles. Path: $.'

This is because we are calling ToJson on the configuration of the draft, and including its ancestors.