I am currently working on a Visual Studio Extension, however I am pretty sure this should apply to all kind of applications.
I have a SimpleInjector Container, in which I want register an IVsSolution
(COM Object). Note that it is marked by the following attributes:
[ComImport]
[Guid("7F7CD0DB-91EF-49DC-9FA9-02D128515DD4")]
[ComConversionLoss]
[InterfaceType(1)]
Anyhow when I try to following code:
var container = new Container();
container.RegisterInstance(IVsSolutionInstance);
It throws the following error:
The supplied type
__ComObject
does not implementIVsSolution
. Parameter name:serviceType
.
I would also guess, that this would apply for all COMImport
types. Anyhow how could I register a COM Type in preferable a SimpleInjector container?
This is a known limitation in Simple Injector v4, which has been fixed in v5.
To work around this problem, create a wrapper implementation of IVsSolution
that wraps the __ComObject and forwards calls to that.