JasperFx / lamar

Fast Inversion of Control Tool and Successor to StructureMap
https://jasperfx.github.io/lamar
MIT License
568 stars 119 forks source link

Decorator registration bug? #158

Closed amelszg closed 5 years ago

amelszg commented 5 years ago

Hi,

i'm having an issue when using a Decorator registration with Lamar.

When constructor param name in Decorator matches the instance name in Lamar, then it resolves to "null".

For example: public MyCarDecorator(IMyCar myCar) { _myCar = myCar ?? throw new ArgumentNullException(nameof(myCar)); }

myCar will be null in this case and exception will be thrown. If i rename the "myCar" param to anything else, then it will work and an instance for IMyCar will be resolved and injected.

Is this behaviour intended?

A test case is attached. (Lamar V3.0.2)

LamarDecoratorTestCase.zip

Thanks and Regards

jeremydmiller commented 5 years ago

@amelszg Can you try this with v3.0.3? It had a fix for a very similar issue related to parameter naming.

amelszg commented 5 years ago

Hi @jeremydmiller ,

thanks for the reply, have tried it with v.3.0.3 and the issue is fixed in that version!

When i created this thread, i was reluctant to upgrade to v.3.0.3 since i saw another post mentioning some multi-threading bug, that's why i stayed on v.3.0.2. but have upgraded now and my issue is solved with it, thanks!

Best regards