P
Peter Zwosta
I have two C# projects:
Project 2 is a test container for project 1. What I'm actually trying
is to write a Filter-Dll for the Microsoft Indexing Service. The
Filter Dll must implement the IFilter interface. Project 2 searches
the windows registry for filter dlls, creates them, casts them to
IFilter and calls the IFilter-methods. That perfectly works for
filters written in any other language and it seems apart from filters
wirtten in c#?
I excpected the statement [ComImport] to make it clear that it's not
an c# interface but from COM imported.
[ComImport]
[Guid("89BCB740-6119-101A-BCB7-00DD010655AF")]
public interface IFilter
{ void Init(); }
Thank you
Peter
PS: Sorry wasn't able to write a follow-up to the last thread
- In project1 TestClass implements a COM interface ITest and builds a
class library (Register for COM interop = true)
- In project2 I create TestClass and want to typecast it to ITest to
call Init. The cast leads to an InvalidCastException.
For communication between .NET objects, type identity is scoped
by the assembly that defines the type. ...
Why are you using COM here at all?
Project 2 is a test container for project 1. What I'm actually trying
is to write a Filter-Dll for the Microsoft Indexing Service. The
Filter Dll must implement the IFilter interface. Project 2 searches
the windows registry for filter dlls, creates them, casts them to
IFilter and calls the IFilter-methods. That perfectly works for
filters written in any other language and it seems apart from filters
wirtten in c#?
So ITest in your first assembly is
different from ITest in the second, even if they happen to be defined
identically and exposed to COM with a single IID.
I excpected the statement [ComImport] to make it clear that it's not
an c# interface but from COM imported.
[ComImport]
[Guid("89BCB740-6119-101A-BCB7-00DD010655AF")]
public interface IFilter
{ void Init(); }
Thank you
Peter
PS: Sorry wasn't able to write a follow-up to the last thread