"Binary format of the specified custom attribute was invalid." retrieving attributes data from .NET 3.5 assembly from a .NET 4.0 application - by Fernando Simonazzi

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 444020 Comments
Status Closed Workarounds
Type Bug Repros 4
Opened 5/7/2009 8:08:33 AM
Access Restriction Public


If an assembly targetting .NET 3.5 has custom attributes with named parameters for a value type defined by the framework, retrieving the assembly's attributes data using CustomAttributeData.GetCustomAttributes(Assembly target) throws an exception with message {"Binary format of the specified custom attribute was invalid."} with the following stack trace:

   at System.Reflection.CustomAttributeEncodedArgument.ParseAttributeArguments(IntPtr pCa, Int32 cCa, CustomAttributeCtorParameter[]& CustomAttributeCtorParameters, CustomAttributeNamedParameter[]& CustomAttributeTypedArgument, IntPtr assembly)
   at System.Reflection.CustomAttributeEncodedArgument.ParseAttributeArguments(ConstArray attributeBlob, CustomAttributeCtorParameter[]& customAttributeCtorParameters, CustomAttributeNamedParameter[]& customAttributeNamedParameters, Module customAttributeModule)
   at System.Reflection.CustomAttributeData..ctor(Module scope, CustomAttributeRecord caRecord)
   at System.Reflection.CustomAttributeData.GetCustomAttributes(Module module, Int32 tkTarget)
   at System.Reflection.CustomAttributeData.GetCustomAttributes(Assembly target)

Retrieving the actual attributes succeeds. Unfortunately, the ResourceManager class loads attribute data, not attributes, causing this failure.
Sign in to post a comment.
Posted by Sarvestan on 2/24/2011 at 2:27 AM
There is no information about how it has been fixed(if it is!), and how we should take care of it. is there any specific patch for this?
Posted by Microsoft on 6/24/2009 at 11:31 AM
Thanks for reporting this issue. We have fixed this in the next version of Visual Studio and .Net Framework!
Posted by Microsoft on 6/17/2009 at 1:23 PM
Hi Fernando,

Thank you for submitting this issue to Microsoft - it's been routed to the appropriate development group on the Common Language Runtime team for investigation. This item will be updated when we have more information.

Thank you,
Andrew Dai
Program Manager - Microsoft Common Language Runtime
Posted by Fernando Simonazzi on 5/19/2009 at 11:43 AM
Checked on Beta 1 that the issue is still there.
Posted by Microsoft on 5/7/2009 at 10:51 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com/)