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

StackOverflowException #43

Closed
ryanbuening opened this issue Jan 3, 2019 · 5 comments

Comments

Projects
None yet
2 participants
@ryanbuening
Copy link

commented Jan 3, 2019

I have TypeGen 2.1.1 package installed and am using version 2.1.1 of the CLI.

I created the GenerationSpec below and added it to the root of my project.

    public class MyGenerationSpec : GenerationSpec
    {
        public MyGenerationSpec()
        {
            AddEnum<FarmDTOs.Loss.Causes>();
        }
    }

FarmDTOs.Loss.Causes is an enum inside of a class which resides in a Nuget package:

namespace FarmDTOs
{
    public class Loss
    {
        public string Id;
        public DateTime Date;
        public Causes Cause;
        public int Amount;

        public Loss();

        public enum Causes
        {
            Unspecified = 0,
            Earthquake = 1,
            Fire = 2,
        }
    }
}

When I run dotnet typegen generate I get the following messages:

Generating files for project "."...
Process is terminating due to StackOverflowException.

Any ideas as to what would be causing this?

@jburzynski

This comment has been minimized.

Copy link
Owner

commented Jan 3, 2019

That looks strange. I'll try to replicate and I'll let you know here when I manage to make a fix. Is the enum the only thing you specify in MyGenerationSpec? Or maybe you also have something that uses FarmDTOs.Loss as a property type (or FarmDTOs.Loss itself) etc.?

@ryanbuening

This comment has been minimized.

Copy link
Author

commented Jan 3, 2019

Yes. The enum was the only thing I had in MyGenerationSpec. I also tried AddClass<FarmDTOs.Loss>(); and received the same error: Process is terminating due to StackOverflowException.

jburzynski added a commit that referenced this issue Jan 4, 2019

@jburzynski

This comment has been minimized.

Copy link
Owner

commented Jan 4, 2019

Turned out this error was due to a typo I made (facepalm)! I've uploaded TypeGen 2.1.2 and this should be fixed.

@jburzynski

This comment has been minimized.

Copy link
Owner

commented Jan 4, 2019

BTW, I haven't tested TypeGen with nested types. If you're using GenerationSpec it should be fine, because you just list the types you want to be generated, but I'm not sure how it would work if there were attributes on nested types. I'll review how it works and make changes in the next release if necessary to make TypeGen work with nested types.

@ryanbuening

This comment has been minimized.

Copy link
Author

commented Jan 4, 2019

Awesome. Thanks for the fix and info.

@jburzynski jburzynski closed this Jan 4, 2019

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.