Daniel pinged me today that he stumbled upon odd issue while trying to update Moq to use Castle DynamicProxy 2.2. I investigate a bit more and it appears to be one of these this-cannot-be-happening-select-is-broken situations.
When DynamicProxy tries to replicate an attribute on one method, its CustomAttributeData contains contradictory information. It happens only when running on .NET 4 (the method in question does not have the attribute in previous versions of BCL)
That’s the method in question in Reflector:
Here’s simplified code sample that reproduces the issue:
Now – what am I missing? Is this really bug in BCL v4 or am I doing something wrong here?