-
-
Notifications
You must be signed in to change notification settings - Fork 846
Closed
Labels
pending-inputPending input or updatePending input or update
Description
Describe the Bug
After updating to Autofac 8.1.1 our tests using Autofac fail with : System.TypeLoadException Could not load type 'System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute'.
Steps to Reproduce
Unfortunately I don't have a good reproduction yet.
- The project that this occurs in has a
netstandard2.1library that is being executed in a test runner onnet6.0andnet8.0. - Reference code/class that has
[RequiresUnreferencedCodeAttribute]
Expected Behavior
On Autofac v8.0.0 no error occurs when resolving classes with this attribute.
On Autofac v8.1.1 the previously mentioned error occurs.
Exception with Stack Trace
System.TypeLoadException Could not load type 'System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute' from assembly 'Autofac, Version=8.1.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da'.
at System.ModuleHandle.ResolveMethod(QCallModule module, Int32 methodToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount)
at System.ModuleHandle.ResolveMethodHandleInternal(RuntimeModule module, Int32 methodToken, ReadOnlySpan`1 typeInstantiationContext, ReadOnlySpan`1 methodInstantiationContext)
at System.ModuleHandle.ResolveMethodHandle(Int32 methodToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.RuntimeType.GetMethodBase(RuntimeModule scope, Int32 typeMetadataToken)
at System.Reflection.RuntimeCustomAttributeData..ctor(RuntimeModule scope, MetadataToken caCtorToken, ConstArray& blob)
at System.Reflection.RuntimeCustomAttributeData.GetCustomAttributes(RuntimeModule module, Int32 tkTarget)
at Autofac.Util.ReflectionExtensions.HasSetsRequiredMembersAttribute(ConstructorInfo constructorInfo)Dependency Versions
Autofac: v8.1.1
Autofac.Extensions.DependencyInjection: v10.0.0
Additional Info
I'll try and create a minumum working example. However it does look like that code related to how attributes are checked changed recently.
Metadata
Metadata
Assignees
Labels
pending-inputPending input or updatePending input or update