Skip to content

StackoverflowException on Get(name) after update from 3.3.4 to 3.3.5 #393

@mur-dock

Description

@mur-dock

Hi there,

I ran into an major issue after updating Ninject up to version 3.3.5.

As you can see in the code below, I want to request an instance of "Dummy" with "TryGet(name)".
But before that I have not registered a corresponding binding of "Dummy".
Therefore, I expected "NULL" as the result of "TryGet".
Ninject tries to create an instance of "Dummy". However, the only constructor available requires that you pass a "string" as a parameter.

And if I pass a "name" as a parameter to "TryGet", then a StackoverflowException occurs.

internal class Program
{
    static void Main(string[] args)
    {
        var kernel = new StandardKernel();
        var dummy = kernel.TryGet<Dummy>("name");
        Debug.Assert(dummy == null);
    }
}

public class Dummy
{
    public Dummy(string name)
    {
        Name = name;
    }

    public string Name { get; set; }
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions