Roger Lipscombe wrote:
> That C# interop was hand-crafted, so it might not actually be
> equivalent to what you'd get from using TLBIMP. Particularly, I'm not
> sure about deriving one interface from the other. I'll take a quick
> look at it today.
Ah. The reason it's hand-crafted is because MIDL and TLBIMP do strange
things with the HWND (see below), which make it hard to use from C#; I
had to change it to use an IntPtr. I've just created a TLB from the
source IDL and imported that using TLBIMP.
Loading that into "Reflector" gives me this:
[ComImport, InterfaceType((short) 1),
Guid("C5C85E31-2F9B-4916-A7BA-8E27D481EE83")]
public interface IBugTraqProvider2 : IBugTraqProvider
{
[MethodImpl(MethodImplOptions.InternalCall,
MethodCodeType=MethodCodeType.Runtime)]
bool ValidateParameters([In,
ComAliasName("BugTraqProviderLib.wireHWND")] ref _RemotableHandle
hParentWnd, [In, MarshalAs(UnmanagedType.BStr)] string parameters);
[return: MarshalAs(UnmanagedType.BStr)]
[MethodImpl(MethodImplOptions.InternalCall,
MethodCodeType=MethodCodeType.Runtime)]
string GetLinkText([In, ComAliasName("BugTraqProviderLib.wireHWND")]
ref _RemotableHandle hParentWnd, [In, MarshalAs(UnmanagedType.BStr)]
string parameters);
[return: MarshalAs(UnmanagedType.BStr)]
[MethodImpl(MethodImplOptions.InternalCall,
MethodCodeType=MethodCodeType.Runtime)]
string GetCommitMessage([In,
ComAliasName("BugTraqProviderLib.wireHWND")] ref _RemotableHandle
hParentWnd, [In, MarshalAs(UnmanagedType.BStr)] string parameters, [In,
MarshalAs(UnmanagedType.BStr)] string commonRoot, [In,
MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_BSTR)]
string[] pathList, [In, MarshalAs(UnmanagedType.BStr)] string
originalMessage);
[return: MarshalAs(UnmanagedType.BStr)]
[MethodImpl(MethodImplOptions.InternalCall,
MethodCodeType=MethodCodeType.Runtime)]
string OnCommitFinished([In,
ComAliasName("BugTraqProviderLib.wireHWND")] ref _RemotableHandle
hParentWnd, [In, MarshalAs(UnmanagedType.BStr)] string commonRoot, [In,
MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_BSTR)]
string[] pathList, [In, MarshalAs(UnmanagedType.BStr)] string
logMessage, [In] uint revision);
}
...so it looks like C# doesn't correctly handle deriving one COM
interface from the other.
Try this:
[ComVisible(true),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
Guid("C5C85E31-2F9B-4916-A7BA-8E27D481EE83")]
public interface IBugTraqProvider2 : IBugTraqProvider
{
[return: MarshalAs(UnmanagedType.VariantBool)]
bool ValidateParameters(IntPtr hParentWnd,
[MarshalAs(UnmanagedType.BStr)] string parameters);
[return: MarshalAs(UnmanagedType.BStr)]
string GetLinkText(IntPtr hParentWnd,
[MarshalAs(UnmanagedType.BStr)] string parameters);
[return: MarshalAs(UnmanagedType.BStr)]
string GetCommitMessage(IntPtr hParentWnd,
[MarshalAs(UnmanagedType.BStr)] string parameters,
[MarshalAs(UnmanagedType.BStr)] string commonRoot,
[MarshalAs(UnmanagedType.SafeArray, SafeArraySubType =
VarEnum.VT_BSTR)] string[] pathList,
[MarshalAs(UnmanagedType.BStr)] string originalMessage);
[return: MarshalAs(UnmanagedType.BStr)]
string OnCommitFinished(
IntPtr hParentWnd,
[MarshalAs(UnmanagedType.BStr)] string commonRoot,
[MarshalAs(UnmanagedType.SafeArray, SafeArraySubType =
VarEnum.VT_BSTR)] string[] pathList,
[MarshalAs(UnmanagedType.BStr)] string logMessage,
[MarshalAs(UnmanagedType.U4)] int revision);
}
If that doesn't work, try it without the ": IBugTraqProvider"
Cheers,
Roger.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_tortoisesvn.tigris.org
For additional commands, e-mail: dev-help_at_tortoisesvn.tigris.org
Received on 2008-10-17 11:14:39 CEST