-
-
Notifications
You must be signed in to change notification settings - Fork 120
Open
Description
I haven't been to get LightInject to run with .NET 8 native AOT. Previously there was AOT compatibility with PCL #81 #305 #318
The Reflection.Emit methods throw a System.PlatformNotSupportedException. Toggling USE_EXPRESSIONS in the source throws IndexOutOfRange in MapGenericArguments
Expression Trees Stacktrace:
at LightInject.GenericArgumentMapper.MapGenericArguments(Type[] serviceTypeGenericArguments, Type[] baseTypeGenericArguments, IDictionary`2 map)
at LightInject.GenericArgumentMapper.MapGenericArguments(Type[] serviceTypeGenericArguments, Type[] baseTypeGenericArguments, IDictionary`2 map)
at LightInject.GenericArgumentMapper.CreateMap(Type genericServiceType, Type openGenericImplementingType, String[] genericParameterNames)
at LightInject.GenericArgumentMapper.Map(Type genericServiceType, Type openGenericImplementingType)
at LightInject.ServiceContainer.EnsureConstructable(Type serviceType, Type implementingType)
at LightInject.ServiceContainer.RegisterService(Type serviceType, Type implementingType, ILifetime lifetime, String serviceName)
at LightInject.ServiceContainer.Register(Type serviceType, Type implementingType, String serviceName, ILifetime lifetime)
at LightInject.AssemblyScanner.RegisterInternal(Type serviceType, Type implementingType, IServiceRegistry serviceRegistry, ILifetime lifetime, Func`3 serviceNameProvider)
at LightInject.AssemblyScanner.BuildImplementationMap(Type implementingType, IServiceRegistry serviceRegistry, Func`1 lifetimeFactory, Func`3 shouldRegister, Func`3 serviceNameProvider)
at LightInject.AssemblyScanner.Scan(Assembly assembly, IServiceRegistry serviceRegistry, Func`1 lifetimeFactory, Func`3 shouldRegister, Func`3 serviceNameProvider)
at LightInject.ServiceContainer.RegisterAssembly(Assembly assembly, Func`1 lifetimeFactory, Func`3 shouldRegister, Func`3 serviceNameProvider)
at LightInject.ServiceContainer.RegisterAssembly(Assembly assembly, Func`1 lifetimeFactory, Func`3 shouldRegister)
at LightInject.ServiceContainer.RegisterAssembly(Assembly assembly, Func`3 shouldRegister)
at LightInject.ServiceContainer.RegisterAssembly(Assembly assembly)
Reflection.Emit Stacktrace:
at System.Reflection.Emit.AssemblyBuilder.ThrowDynamicCodeNotSupported()
at System.Reflection.Emit.AssemblyBuilder.EnsureDynamicCodeSupported()
at System.Reflection.Emit.DynamicMethod.Init(String name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] signature, Type owner, Module m, Boolean skipVisibility, Boolean transparentMethod)
at System.Reflection.Emit.DynamicMethod..ctor(String name, Type returnType, Type[] parameterTypes, Module m, Boolean skipVisibility)
at LightInject.ServiceContainer.DynamicMethodSkeleton.CreateDynamicMethod(Type returnType, Type[] parameterTypes)
at LightInject.ServiceContainer.DynamicMethodSkeleton..ctor(Type returnType, Type[] parameterTypes)
at LightInject.ServiceContainer.<>c.<.ctor>b__29_1(Type returnType, Type[] parameterTypes)
at LightInject.ServiceContainer.CreateDynamicMethodDelegate(Action`1 serviceEmitter)
at LightInject.ServiceContainer.CreateDelegate(Type serviceType, String serviceName, Boolean throwError)
at LightInject.ServiceContainer.CreateDefaultDelegate(Type serviceType, Boolean throwError)
at LightInject.ServiceContainer.GetInstance(Type serviceType)
at LightInject.ServiceFactoryExtensions.GetInstance[TService](IServiceFactory
Metadata
Metadata
Assignees
Labels
No labels