A COM component is currently implemented in C++ and the next version must be implemented in C#. The component is called from C++ (not CLI) code. The major part of the not so small component is already ported to C#, but I have trouble to figure out how one specific method can be translated.
Interface definition
The following imports are used in the IDL:
import "oaidl.idl";
import "ocidl.idl";
The major part of the interface is already translated to the corresponding C# attributes, interfaces and classes. Most of it works without problems.
But one of the interface members is defined in IDL as
[
object,
uuid(<guid>),
helpstring("Help"),
pointer_default(unique)
]
interface IStuff : IUnknown
{
...
HRESULT GetShortText([in] int i, [in] BOOL b, [out, string] TCHAR shortText[10]);
...
}
Usage
To use the interface, a local TCHAR[10]
array is passed as the name of the array (therefore, as a TCHAR*
). The COM server must put a short string in the TCHAR array.
Problem
I can't manage to call the method. Breakpoints set in the C# COM server in the GetShortText
method are never hit. COM simply doensn't find my implementation in .NET.
How can this method that is called with a fixed size TCHAR*
be correctly implemented in C#?