JasperFx / lamar

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

Parameter.Name can be null #375

Closed worldspawn closed 10 months ago

worldspawn commented 1 year ago

This bit of code: https://github.com/JasperFx/lamar/blob/88286f99231b7bc3de041688382257a815e66c3a/src/Lamar/IoC/Instances/CtorArg.cs#L38

Doesn't check if Parameter.Name is null. If the type is a generated type the parameter names can be null.

A real world example of this is using MassTransit's multi-bus feature. It generates a type with a constructor + parameter but doesn't give it a name. That type is then registered with the container and resolving it fails.

jeremydmiller commented 1 year ago

I'm gonna happily take a PR for that one. Can't say that I knew that was possible. Also, MT does some wacky stuff in its internals.

worldspawn commented 1 year ago

I'd do a PR, but I don't know enough about the why of whats in the if... what's around the if :D etc etc.

I PR'd specifying a name into MT so I'm unblocked.

jeremydmiller commented 10 months ago

Sorry, back to Lamar issues today. What are you even doing that hits this btw?

jeremydmiller commented 10 months ago

Nevermind, I saw the "MassTransit" remark. Pfft.