Closed hellfirehd closed 2 years ago
I had this exact same issue in a previous version after adding
services.AddHttpClient();
to my Startup.cs config, but in version 6 I now get this instead:
System.NullReferenceException: 'Object reference not set to an instance of an object.'
at Lamar.IoC.Instances.CtorArg..ctor(ParameterInfo parameter, Instance instance)
at Lamar.IoC.Instances.ConstructorInstance.determineArgument(ServiceGraph services, ParameterInfo parameter)
at Lamar.IoC.Instances.ConstructorInstance.<>c__DisplayClass29_0.<buildOutConstructorArguments>b__0(ParameterInfo x)
at System.Linq.Enumerable.SelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.ToArray()
at System.Linq.Enumerable.ToArray[TSource](IEnumerable``1 source)
at Lamar.IoC.Instances.ConstructorInstance.buildOutConstructorArguments(ServiceGraph services)
at Lamar.IoC.Instances.ConstructorInstance.createPlan(ServiceGraph services)
at Lamar.IoC.Instances.Instance.CreatePlan(ServiceGraph services)
at Lamar.IoC.Instances.ConstructorInstance.buildOutConstructorArguments(ServiceGraph services)
at Lamar.IoC.Instances.ConstructorInstance.createPlan(ServiceGraph services)
at Lamar.IoC.Instances.Instance.CreatePlan(ServiceGraph services)
at Lamar.ServiceGraph.planResolutionStrategies()
at Lamar.ServiceGraph.buildOutMissingResolvers()
at LamarCodeGeneration.Util.PerfTimer.Record(String text, Action action)
at Lamar.ServiceGraph.Initialize(PerfTimer timer)
at Lamar.IoC.Scope..ctor(IServiceCollection services, PerfTimer timer)
at Lamar.Container..ctor(IServiceCollection services)
at Lamar.Microsoft.DependencyInjection.LamarServiceProviderFactory.CreateServiceProvider(ServiceRegistry containerBuilder)
at Microsoft.Extensions.Hosting.Internal.ServiceFactoryAdapter`1.CreateServiceProvider(Object containerBuilder)
at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at Program.Main(String[] args)
Good times. I'm on it.
I'm hardening the code to trap exceptions and just use Type.Name if it can't figure it out, but I can't reproduce this locally guy. @jdub4237's problem is unrelated.
for @jdub4237 I added better exceptions, but I have no idea what that's from, and again, I'm not able to reproduce the issue locally.
In dev I always log WhatDidIScan() and WhatDoIHave() on startup. After upgrading to v6.0.0 it started throwing the following:
I can do a Live Share session if it would help.