SharpCrafters Forum – Implementing IAnnotationProvider

SharpCrafters Support Forum

        


Implementing IAnnotationProvider Expand / Collapse
Author
Message
Posted 12/20/2009 7:02:49 AM


Community Member
It appears that a task implementing IAnnotationProvider has stricter requirements that just implementing the GetAnnotations() method. If I return an enumerator for AnnotationInstances that I have constructed with the necessary MetaDataDeclaration (in my case a MethodDefDeclaration for the method I am trying to programmatically annotate) and custom attribute constructor, the MultiCastAttributeTask fails trying to cast the AnnotationInstance to a CustomAttributeDeclaration. If I return an enumerator for CustomAttributeDeclarations I have constructed (which seems like the wrong thing to do anyway), the AnnotationRepositoryTask fails with a null reference exception (trying to add an item to a dictionary using null as the key).

What all is necessary to implement IAnnotationProvider? It was my hope that one could simulate annotation of third party assemblies (system assemblies in particular) by doing this.
Post #666
Posted 12/21/2009 3:20:49 PM


Gael Fraiteur

SharpCrafters
If MultiCastAttributeTask fails with a cast exception, you may consider it a bug of PostSharp. The vision is that you provide an IAnnotationInstance, not a CustomAttributeDeclaration. So please report this as a bug.
Post #667
« Prev Topic | Next Topic »


All times are GMT +1:00, Time now is 11:44am

Powered By InstantForum.NET v4.1.4 © 2010
Execution: 0.055. 8 queries. Compression Disabled.