diff --git a/src/Lamar/IoC/Instances/CtorArg.cs b/src/Lamar/IoC/Instances/CtorArg.cs index fd1f3855..f0f6a05d 100644 --- a/src/Lamar/IoC/Instances/CtorArg.cs +++ b/src/Lamar/IoC/Instances/CtorArg.cs @@ -2,6 +2,7 @@ using System.Reflection; using JasperFx.CodeGeneration.Model; using JasperFx.Core; +using JasperFx.Core.Reflection; using Lamar.IoC.Frames; namespace Lamar.IoC.Instances; @@ -23,7 +24,7 @@ public CtorArg(ParameterInfo parameter, Instance instance) catch (Exception e) { throw new InvalidOperationException( - $"Cannot create a Constructor Argument for {parameter.Name} of {instance}", e); + $"Cannot create a Constructor Argument for {parameter?.Name ?? "anonymous"} of type {parameter.ParameterType.FullNameInCode()} of {instance}. If this is a primitive type like strings or numbers, Lamar will not do any automatic resolution by type", e); } }