Why am I getting a "TypeLoadException"

J

JohnS

Hi there,

I have a fairly simple console app (.exe) in C# which runs fine in WinXP
(32 bits) but under Windows Server 2008 (64 bit) I get the following error
very early in the life of the app:

System.TypeLoadException: Method 'MyMethod' in type 'MyClass' from assembly
'MyApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have
an implementation.

Note that "MyClass" is a locally defined private class (in the ".exe") which
implements an interface defined in a C# DLL in the same folder as the
".exe". "MyMethod" is one of the interface methods and this returns an
interface from a C++/CLI DLL that's also located in the same folder. My
guess is that there's an issue with this return value. It should find it in
the C++/CLI DLL but I'm guessing it's not. Can anyone shed any light? Thank
you.
 
A

Arne Vajhøj

I have a fairly simple console app (.exe) in C# which runs fine in WinXP
(32 bits) but under Windows Server 2008 (64 bit) I get the following
error very early in the life of the app:

System.TypeLoadException: Method 'MyMethod' in type 'MyClass' from
assembly 'MyApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
does not have an implementation.

Note that "MyClass" is a locally defined private class (in the ".exe")
which implements an interface defined in a C# DLL in the same folder as
the ".exe". "MyMethod" is one of the interface methods and this returns
an interface from a C++/CLI DLL that's also located in the same folder.
My guess is that there's an issue with this return value. It should find
it in the C++/CLI DLL but I'm guessing it's not. Can anyone shed any
light? Thank you.

Difficult to say based on the available info.

Any chance that the C++ DLL really is a mixed mode DLL?

Arne
 
J

JohnS

Any chance that the C++ DLL really is a mixed mode DLL?

No. It's 32 bit running under WOW64. I'm not usually one to blame MSFT since
programmers are usually at fault (whenever they do blame MSFT), but it
wouldn't surprise me if this were a bug (it runs under XP ok and I see no
immediate reason why the problem should exist on a 64 bit machine). Anyway,
thanks for the feedback.
 

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