ObjectExporter icon indicating copy to clipboard operation
ObjectExporter copied to clipboard

Can't resolve reference graphs with circular references.

Open ghost opened this issue 8 years ago • 4 comments

Consder the following types:

class Parent
{
     public List<Child> Children { get; set; }
}

class Child
{
    public Parent Parent { get; set; }
}

Whenever trying to calculate depth in such cases, and whenever trying to export such objects. The plugin works very long and then crashes along with Visual Studio.

ghost avatar Jul 21 '16 07:07 ghost

The depth solver has two options for stopping the depth calculation, one is level (default 25) and the other is timeout (20,000 ms). Can you double check these settings? You can also try adjusting them (Maybe a cutoff of 5 instead of 25).

image

I'll try and see if I can't replicate the issue.

OmarElabd avatar Jul 21 '16 15:07 OmarElabd

Hi OmarElabd,

I noticed those settings. When I specify a Maximum Depth Cutoff - let's say, with 3, the object exporter dialog successfully calculates "depths" for my objects and gives me ">3" as a result. But when Exporting, the plugin still runs indefinitely and crashes.

I know this is very specific to the data that I have in my application. And your plugin is really useful, it's just that you guys need to handle such corner cases in your serializing/depth calculation code.

ghost avatar Jul 22 '16 11:07 ghost

Is it possible to perhaps have another type of export, NewtonsoftJson? It has the ability to generate JSON which when serialized will provide the information necessary to deserialize the object graph with the circular references.

mikejr83 avatar Feb 14 '17 20:02 mikejr83

Hi @mikejr83, it is possible to resolve circular references in C#, JSON and XML. See #33 for more details. This would require a big change to how the objects are currently serialized, but it's definitely on the horizon.

OmarElabd avatar Feb 14 '17 21:02 OmarElabd