CS0536 Error

R

Roland

Hi All,

I'm trying to generate a C# wrapper for a Windows type library using the following command line ...

csc /target:library /doc:Interop.MyLibrary.xml /unsafe Interop.MyLibrary.cs >Interop.MyLibrary.log

And receiving the following error message ...

Interop.MyLibrary.cs(499,18): error CS0536: 'Interop.MyLibrary.IImpBaseCollection_SinkHelper' does not implement interface member 'Interop.MyLibrary.IImpBaseCollection.Item(object)'. 'Interop.MyLibrary.IImpBaseCollection_SinkHelper.Item(object)' is either static, not public, or has the wrong return type.

Here's the code....

The line where the error occurs is in Bold Blue

Any ideas appreciated!! ;-)

Thanks,
Roland

-----------------


/// <summary><para><c>IImpBaseCollection</c> interface.</para></summary>
[Guid("5616A320-AB4D-11D0-8E2F-00A0C9050603")]

[ComImport]

[TypeLibType((short)4096)]

[DefaultMember("Item")]

[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]

public interface IImpBaseCollection: System.Collections.IEnumerable

{

/// <summary><para><c>Item</c> method of <c>IImpBaseCollection</c> interface.</para></summary>

/// <remarks><para>An original IDL definition of <c>Item</c> method was the following: <c>HRESULT Item (VARIANT nIndex, [out, retval] IDispatch** ReturnValue)</c>;</para></remarks>

// IDL: HRESULT Item (VARIANT nIndex, [out, retval] IDispatch** ReturnValue);

// VB6: Function Item (ByVal nIndex As Any) As IDispatch

[DispId(0)]

[return: MarshalAs(UnmanagedType.IDispatch)]

object Item (object nIndex);

/// <summary><para><c>_NewEnum</c> property of <c>IImpBaseCollection</c> interface.</para></summary>

/// <remarks><para>An original IDL definition of <c>_NewEnum</c> property was the following: <c>IUnknown* _NewEnum</c>;</para></remarks>

// IDL: IUnknown* _NewEnum;

// VB6: _NewEnum As IUnknown

object _NewEnum

{

// IDL: HRESULT _NewEnum ([out, retval] IUnknown** ReturnValue);

// VB6: Function _NewEnum As IUnknown

[DispId(-4)]

[return: MarshalAs(UnmanagedType.IUnknown)]

get;

}

/// <summary><para>Parent property of IImpBaseCollection interface.</para></summary>

/// <remarks><para>An original IDL definition of <c>Parent</c> property was the following: <c>IDispatch* Parent</c>;</para></remarks>

// IDL: IDispatch* Parent;

// VB6: Property Parent As IDispatch

[DispId(2)]

object Parent

{

[return: MarshalAs(UnmanagedType.IDispatch)]

get;

}

/// <summary><para>Count property of IImpBaseCollection interface.</para></summary>

/// <remarks><para>An original IDL definition of <c>Count</c> property was the following: <c>long Count</c>;</para></remarks>

// IDL: long Count;

// VB6: Property Count As Long

[DispId(3)]

int Count

{

get;

}

}

/// <summary><para>Delegate for handling <c>Item</c> event of <c>IImpBaseCollection</c> interface.</para></summary>

/// <remarks><para>An original IDL definition of <c>Item</c> event was the following: <c>HRESULT IImpBaseCollection_ItemEventHandler (VARIANT nIndex, [out, retval] IDispatch** ReturnValue)</c>;</para></remarks>

// IDL: HRESULT IImpBaseCollection_ItemEventHandler (VARIANT nIndex, [out, retval] IDispatch** ReturnValue);

// VB6: Function IImpBaseCollection_ItemEventHandler (ByVal nIndex As Any) As IDispatch

[return: MarshalAs(UnmanagedType.IDispatch)]

public delegate object IImpBaseCollection_ItemEventHandler (object nIndex);

/// <summary><para>Delegate for handling <c>_NewEnum</c> event of <c>IImpBaseCollection</c> interface.</para></summary>

/// <remarks><para>An original IDL definition of <c>_NewEnum</c> event was the following: <c>HRESULT IImpBaseCollection__NewEnumEventHandler ([out, retval] IUnknown** ReturnValue)</c>;</para></remarks>

// IDL: HRESULT IImpBaseCollection__NewEnumEventHandler ([out, retval] IUnknown** ReturnValue);

// VB6: Function IImpBaseCollection__NewEnumEventHandler As IUnknown

[return: MarshalAs(UnmanagedType.IUnknown)]

public delegate object IImpBaseCollection__NewEnumEventHandler () /* property get method */;

/// <summary><para>Declaration of events of <c>IImpBaseCollection</c> source interface.</para></summary>

[ComEventInterface(typeof(IImpBaseCollection),typeof(IImpBaseCollection_EventProvider))]

[ComVisible(false)]

public interface IImpBaseCollection_Event

{

/// <summary><para><c>Item</c> event of <c>IImpBaseCollection</c> interface.</para></summary>

event IImpBaseCollection_ItemEventHandler Item;

/// <summary><para><c>_NewEnum</c> event of <c>IImpBaseCollection</c> interface.</para></summary>

event IImpBaseCollection__NewEnumEventHandler _NewEnum;

}

[ClassInterface(ClassInterfaceType.None)]

internal class IImpBaseCollection_SinkHelper: IImpBaseCollection

{

public int Cookie = 0;

public event IImpBaseCollection_ItemEventHandler ItemDelegate = null;

public void Set_ItemDelegate(IImpBaseCollection_ItemEventHandler deleg)

{

ItemDelegate = deleg;

}

public bool Is_ItemDelegate(IImpBaseCollection_ItemEventHandler deleg)

{

return (ItemDelegate == deleg);

}

public void Clear_ItemDelegate()

{

ItemDelegate = null;

}

void Item (object nIndex)

{

if (ItemDelegate!=null)

ItemDelegate(nIndex);

}

public event IImpBaseCollection__NewEnumEventHandler _NewEnumDelegate = null;

public void Set__NewEnumDelegate(IImpBaseCollection__NewEnumEventHandler deleg)

{

_NewEnumDelegate = deleg;

}

public bool Is__NewEnumDelegate(IImpBaseCollection__NewEnumEventHandler deleg)

{

return (_NewEnumDelegate == deleg);

}

public void Clear__NewEnumDelegate()

{

_NewEnumDelegate = null;

}

void _NewEnum () /* property get method */

{

if (_NewEnumDelegate!=null)

_NewEnumDelegate();

}

}
 
R

Ravikanth[MVP]

Hi

The compiler did not detect an interface member
implementation. A declaration may be present that almost
implements the interface member. Check for the following
syntax errors in the declaration for the interface
member:

public keyword is omitted.
Return type does not match.
static keyword is present.

HTH
Ravikanth[MVP]
-----Original Message-----
Hi All,

I'm trying to generate a C# wrapper for a Windows type
library using the following command line ...
csc /target:library /doc:Interop.MyLibrary.xml /unsafe
Interop.MyLibrary.cs >Interop.MyLibrary.log
And receiving the following error message ...

Interop.MyLibrary.cs(499,18): error
CS0536: 'Interop.MyLibrary.IImpBaseCollection_SinkHelper'
does not implement interface
member 'Interop.MyLibrary.IImpBaseCollection.Item
(object)'. 'Interop.MyLibrary.IImpBaseCollection_SinkHelpe
r.Item(object)' is either static, not public, or has the
wrong return type.
Here's the code....

The line where the error occurs is in Bold Blue

Any ideas appreciated!! ;-)

Thanks,
Roland

-----------------


/// <summary><para><c>IImpBaseCollection</c>
interface. said:
[Guid("5616A320-AB4D-11D0-8E2F-00A0C9050603")]

[ComImport]

[TypeLibType((short)4096)]

[DefaultMember("Item")]

[InterfaceTypeAttribute
(ComInterfaceType.InterfaceIsIDispatch)]

public interface IImpBaseCollection: System.Collections.IEnumerable

{

/// <summary><para><c>Item</c> method of
/// <remarks><para>An original IDL definition of
<c>Item</c> method was the following: <c>HRESULT Item
(VARIANT nIndex, [out, retval] IDispatch** ReturnValue)
// IDL: HRESULT Item (VARIANT nIndex, [out, retval] IDispatch** ReturnValue);

// VB6: Function Item (ByVal nIndex As Any) As IDispatch

[DispId(0)]

[return: MarshalAs(UnmanagedType.IDispatch)]

object Item (object nIndex);

/// <summary><para><c>_NewEnum</c> property of
/// <remarks><para>An original IDL definition of
// IDL: IUnknown* _NewEnum;

// VB6: _NewEnum As IUnknown

object _NewEnum

{

// IDL: HRESULT _NewEnum ([out, retval] IUnknown** ReturnValue);

// VB6: Function _NewEnum As IUnknown

[DispId(-4)]

[return: MarshalAs(UnmanagedType.IUnknown)]

get;

}

/// <summary><para>Parent property of IImpBaseCollection
interface. said:
/// <remarks><para>An original IDL definition of
// IDL: IDispatch* Parent;

// VB6: Property Parent As IDispatch

[DispId(2)]

object Parent

{

[return: MarshalAs(UnmanagedType.IDispatch)]

get;

}

/// <summary><para>Count property of IImpBaseCollection
interface. said:
/// <remarks><para>An original IDL definition of
// IDL: long Count;

// VB6: Property Count As Long

[DispId(3)]

int Count

{

get;

}

}

/// <summary><para>Delegate for handling <c>Item</c>
event of said:
/// <remarks><para>An original IDL definition of
<c>Item</c> event was the following: <c>HRESULT
IImpBaseCollection_ItemEventHandler (VARIANT nIndex,
[out, retval] IDispatch** ReturnValue)
// IDL: HRESULT IImpBaseCollection_ItemEventHandler
(VARIANT nIndex, [out, retval] IDispatch** ReturnValue);
// VB6: Function IImpBaseCollection_ItemEventHandler
(ByVal nIndex As Any) As IDispatch
[return: MarshalAs(UnmanagedType.IDispatch)]

public delegate object
IImpBaseCollection_ItemEventHandler (object nIndex);
/// <summary><para>Delegate for handling <c>_NewEnum</c>
event of said:
/// <remarks><para>An original IDL definition of
<c>_NewEnum</c> event was the following: <c>HRESULT
IImpBaseCollection__NewEnumEventHandler ([out, retval]
IUnknown** ReturnValue) said:
// IDL: HRESULT IImpBaseCollection__NewEnumEventHandler
([out, retval] IUnknown** ReturnValue);
// VB6: Function IImpBaseCollection__NewEnumEventHandler As IUnknown

[return: MarshalAs(UnmanagedType.IUnknown)]

public delegate object
IImpBaseCollection__NewEnumEventHandler () /* property
get method */;
/// <summary><para>Declaration of events of
[ComEventInterface(typeof(IImpBaseCollection),typeof
(IImpBaseCollection_EventProvider))]

[ComVisible(false)]

public interface IImpBaseCollection_Event

{

/// <summary><para><c>Item</c> event of
event IImpBaseCollection_ItemEventHandler Item;

/// <summary><para><c>_NewEnum</c> event of
event IImpBaseCollection__NewEnumEventHandler _NewEnum;

}

[ClassInterface(ClassInterfaceType.None)]

internal class IImpBaseCollection_SinkHelper: IImpBaseCollection

{

public int Cookie = 0;

public event IImpBaseCollection_ItemEventHandler ItemDelegate = null;

public void Set_ItemDelegate
(IImpBaseCollection_ItemEventHandler deleg)
{

ItemDelegate = deleg;

}

public bool Is_ItemDelegate
(IImpBaseCollection_ItemEventHandler deleg)
{

return (ItemDelegate == deleg);

}

public void Clear_ItemDelegate()

{

ItemDelegate = null;

}

void Item (object nIndex)

{

if (ItemDelegate!=null)

ItemDelegate(nIndex);

}

public event IImpBaseCollection__NewEnumEventHandler _NewEnumDelegate = null;

public void Set__NewEnumDelegate
(IImpBaseCollection__NewEnumEventHandler deleg)
{

_NewEnumDelegate = deleg;

}

public bool Is__NewEnumDelegate
(IImpBaseCollection__NewEnumEventHandler deleg)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top