I've been trying to sign an assembly and getting this error:
'Utils.Connection' does not implement interface member 'Interfaces.IConnection.BugFactory()'. 'Utils.Connection.BugFactory()' cannot implement 'Interfaces.IConnection.BugFactory()' because it does not have the matching return type of 'ThirdPartyLibrary.BugFactory'.
That error looks like a dirty, dirty lie! In Utils.Connection
, I have this method:
public new BugFactory BugFactory()
I don't think the new
keyword is the problem because 1) removing it doesn't stop the error and 2) I'm having the same error with another class that implements IConnection
that does not use the new
keyword. Update: if I use override
instead of new
, I get this error:
'Utils.Connection.BugFactory()': cannot override because 'ThirdPartyLibrary.ConnectionClass.BugFactory' is not a function
This is because ThirdPartyLibrary.ConnectionClass.BugFactory
is a property.
There is only one BugFactory
class, so it isn't a problem of the interface requiring a different BugFactory
return type than what the method returns. Even if I explicitly mark my method as returning ThirdPartyLibrary.BugFactory
, I still get the error when I try to strong-name the Utils
DLL.
Could this be the result of ThirdPartyLibrary
being an old COM library that is not CLS-compliant? I have no control over this library. When I do not try to sign the Utils
assembly, I do not get the interface error.
My big question is: how can I sign this assembly?
Edit: here's what IConnection
has:
using ThirdPartyLibrary; // The only using statement
namespace Interfaces
{
public interface IConnection
{
...
BugFactory BugFactory();
}
}