Skip to content

The dynamic type created is thrown Fileloadexception when using the GetCustomAttributes method.  #1481

@faib920

Description

@faib920

I Use TypeBuilder create a testclass, and use SetCustomAttributes to add custom attribute, then I use the method of GetCustomAttributes, throw FileLoadFileException.

FileLoadException:
Could not load file or assembly '_testclass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Operation is not supported. (Exception from HRESULT: 0x80131515)

inner Exception
System.NotSupportedException
Resolving to a collectible assembly is not supported.

StackTrace:
at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.Attribute.GetCustomAttributes(MemberInfo element, Type type, Boolean inherit)
at System.Reflection.CustomAttributeExtensions.GetCustomAttributes[T](MemberInfo element, Boolean inherit)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions