IContracts and passing interfaces

Jan 21, 2010 at 4:40 PM


I've developed a simple application based on your framework. One of the methods of my contract contains an argument which is an interface that i've developed. This particular interface is contained into an assembly which is shared amongst the host and the addin. I've compiled the application and executed a simple test. So far, so good, the host and the addin seem to communicate without a problem. However, when i run FxCop on the contract assembly, using your rules, i obtain the following error:

CheckId: AF0013
Message: "All interfaces used in contract assemblies should implement IContract"

The problem is obvious: my interface is on another assembly and cannot implement IContract. Thus, i've created another contract which implements both IContract and my interface and changed the methods of my previous contract in order to make use of this newly created contract. Changed both host and addin in order to be compliant with this modification. Again, compiling and executing the solution offered no problems. Running FxCop yet again shows this error:

CheckId: AF0004
Message:Contract interfaces should not implement non-IContract interfaces

So far i'm confused. Is there a way to tackle this problem? How can i pass interfaces in methods specified by a contract? What are the implications of not fixing those problems reported by FxCop? Is there a best practice regarding to this matter?

Thanks in advance,

Pedro Costa