You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.1 library that is being executed in a test runner on net6.0 and net8.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)
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.
netstandard2.1
library that is being executed in a test runner onnet6.0
andnet8.0
.[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
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.
RequiredMemberAttribute
search #1415required
infrastructure attributes #1421The text was updated successfully, but these errors were encountered: