method not emitted to IL?

L

Lee Crabtree

I have a managed C++ class that wraps a native C++ DLL. The managed
class is visible from C# without any problem, except for one method.
One method out of six or seven isn't visible in the Object Viewer, or
visible to Intellisense. DotExplorer tells me that the data is present
in the metadata for the assembly, and if I just manually put the method
in code, I can use it as normal, but this is just too weird for me not
to ask around about it.

Anybody have any ideas?

Lee Crabtree
 
B

Barry Kelly

Lee Crabtree said:
I have a managed C++ class that wraps a native C++ DLL. The managed
class is visible from C# without any problem, except for one method.
One method out of six or seven isn't visible in the Object Viewer, or
visible to Intellisense. DotExplorer tells me that the data is present
in the metadata for the assembly, and if I just manually put the method
in code, I can use it as normal, but this is just too weird for me not
to ask around about it.

Can you show us some code that demonstrates the problem?

-- Barry
 
L

Lee Crabtree

Yeah, sorry, I should have the first time around, but I've been pretty
flummoxed trying to figure this thing out.

Let's say I have a native class like this:

class Thing
{
public:
Thing();
~Thing();

int Work();
void Stop();
bool Restart();
bool Sleep();
};

The wrapper I've got is something like this:

public __gc class MThing
{
public:
MThing();
~MThing();

virtual int Work();
virtual void Stop();
virtual bool Restart();
virtual bool Sleep();

private:
Thing* unmanagedThing;
};

When I go to use my class in C#, though, Sleep, for example, doesn't
show up in the Object Browser, isn't in the Intellisense list, and just
generally looks invisible. I CAN use the function, I just have to do it
manually (that is, no reminding about what it takes and returns).

I realize that crying that I don't have my Intellisense is more than a
little retarded. I'm more worried that this might signal something
deeper being off kilter.

Lee Crabtree
 
B

Barry Kelly

Lee Crabtree said:
public __gc class MThing

I assume you're using VS03, then.
When I go to use my class in C#, though, Sleep, for example, doesn't
show up in the Object Browser, isn't in the Intellisense list, and just
generally looks invisible. I CAN use the function, I just have to do it
manually (that is, no reminding about what it takes and returns).

Strange. It simply sounds like a VS bug. I wonder: if you use reflection
and typeof(MThing).GetMethods(), is there any noticable difference
between the different MethodInfos? Does .NET Reflector show any
difference?

-- Barry
 
L

Lee Crabtree

Barry said:
I assume you're using VS03, then.

Actually, my C# is VS2005 Express. The DLL was wrapped while we were
using 2003, but C++ 2005 Express allows the old syntax.
Strange. It simply sounds like a VS bug. I wonder: if you use reflection
and typeof(MThing).GetMethods(), is there any noticable difference
between the different MethodInfos? Does .NET Reflector show any
difference?

-- Barry

I've been using DotExplorer to examine the metadata in the assembly, and
it shows the method just fine.

Lee Crabtree
 

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