Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / September 2003

Tip: Looking for answers? Try searching our database.

CS0536 Error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Roland - 26 Sep 2003 08:06 GMT
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....

(Line 499
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)]

// ***** THIS IS LINE 499  ********
public interface IImpBaseCollection: System.Collections.IEnumerable
{

[DispId(0)]
[return: MarshalAs(UnmanagedType.IDispatch)]
object Item (object nIndex);

object _NewEnum
{

[DispId(-4)]

[return: MarshalAs(UnmanagedType.IUnknown)]

get;

}

[DispId(2)]

object Parent

{

[return: MarshalAs(UnmanagedType.IDispatch)]

get;

}

[DispId(3)]

int Count
{
get;
}

}

[return: MarshalAs(UnmanagedType.IDispatch)]
public delegate object IImpBaseCollection_ItemEventHandler (object nIndex);

[return: MarshalAs(UnmanagedType.IUnknown)]
public delegate object IImpBaseCollection__NewEnumEventHandler () /*
property get method */;

[ComEventInterface(typeof(IImpBaseCollection),typeof(IImpBaseCollection_Even
tProvider))]
[ComVisible(false)]

public interface IImpBaseCollection_Event

{
event IImpBaseCollection_ItemEventHandler Item;
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();
}

}
Vadim Melnik - 26 Sep 2003 10:27 GMT
Hi Roland,

> 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.

"IImpBaseCollection" defines Item as:

   object Item (object nIndex);

But "IImpBaseCollection_SinkHelper" use another return type for Item method:

   void Item (object nIndex)

Hope it helps.

..
Cheers,
Vadim.

> Hi All,
>
[quoted text clipped - 75 lines]
> public delegate object IImpBaseCollection__NewEnumEventHandler () /*
> property get method */;

[ComEventInterface(typeof(IImpBaseCollection),typeof(IImpBaseCollection_Even
> tProvider))]
> [ComVisible(false)]
[quoted text clipped - 65 lines]
>
> }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.