Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circular reference creates Stack Overflow #4

Closed
daveriedstra opened this issue Feb 1, 2017 · 6 comments

Comments

Projects
None yet
2 participants
@daveriedstra
Copy link

commented Feb 1, 2017

Given

public class Foo
{
    public Bar myBar { get; set; }
}

public class Bar
{
    public Foo myFoo { get; set; }
}

TypeGen crashes with stack overflow

Process is terminated due to StackOverflowException.

Giving the type with, eg, [TsType("Foo", "./foo")] works fine.

@jburzynski

This comment has been minimized.

Copy link
Owner

commented Feb 7, 2017

Resolved in 1.5.1. I'm leaving this open for some time, in case there are still some issues.

@jburzynski jburzynski closed this Feb 13, 2017

@daveriedstra

This comment has been minimized.

Copy link
Author

commented Feb 22, 2017

This is still an issue for me in 1.5.1, unfortunately.

@jburzynski jburzynski reopened this Feb 22, 2017

@jburzynski

This comment has been minimized.

Copy link
Owner

commented Feb 22, 2017

Can you confirm TypeGen's version is 1.5.1 (should be displayed when executing TypeGen -h)?

Could you also specify how the classes are placed relative to each other (i.e. in the same/different folder/namespace etc.)?

Thanks

@daveriedstra

This comment has been minimized.

Copy link
Author

commented Feb 22, 2017

_>TypeGen -h
TypeGen v1.5.1
Usage: TypeGen ProjectFolder1[:ProjectFolder2:(...)] [-Config-Path "path1[:path2:(...)]"] [Get-Cwd] [-h | -Help] [-v | -Verbose]
For more information please visit project's GitHub page: https://github.com/jburzynski/TypeGen

I just tried to apply this to a big update to our model, and it came up several times. The classes are in the same directory and in separate files. Here's an overview of the two classes involved in one instance:

Invoice.cs (this class is referenced in another class, so I don't have ExportTsClassAttribute)

namespace OurNS.Models
{
    using TypeGen.Core.TypeAnnotations;
    public class Invoice : AffilateNavigationObject<Guid>
    {
         // ... 

        public List<InvoiceLine> InvoiceLineItems { get; set; } = new List<InvoiceLine>();

        // ...
    }
}

InvoiceLine.cs

namespace OurNS.Models
{
    using TypeGen.Core.TypeAnnotations;
    public class InvoiceLine
    {
        // ...

        // [TsType("Invoice", "./invoice")] // <-- fixes the circular reference problem
        public Invoice Invoice { get; set; }

        // ...
    }
}
@jburzynski

This comment has been minimized.

Copy link
Owner

commented Feb 23, 2017

Thanks; based on your example I was able to replicate this error. It occurs in a different scenario than the one I fixed.

I should be able to fix it in the next release - I'll chuck in some minor improvements as well, so the next version should be out in a couple of days.

@jburzynski

This comment has been minimized.

Copy link
Owner

commented Feb 25, 2017

1.5.2 1.5.3 is out - it includes bugfix to this issue plus some other smaller changes.

As previously, I'll keep this thread open for some time.

@jburzynski jburzynski closed this Mar 14, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.