?
Solved

TypeLoadException was undhandled, please help!

Posted on 2007-07-30
7
Medium Priority
?
302 Views
Last Modified: 2013-11-07
hi expert

i have a DLL, a .NET Wrapper

i downloaded here : http://midimick.com/magicknet/magickDoc.html

when i added the dll in the reference of my project, no problem
when i launch the application (winform) : no problem

now i add just ONE LINE that are using the DLL, the project cannot be launched :

=> unable to launch assembly...
=> typeloadException was undhandled

can somebody help me?

regards
0
Comment
Question by:Dnx_7
  • 3
4 Comments
 
LVL 7

Expert Comment

by:multithreading
ID: 19610303
Probably throwing an exception in the static constructor for the type you referenced. Try adding a try/catch in the static constructor code, and log the exception, or put a breakpoint in the static constructor code and step through it in the debugger.
0
 
LVL 2

Author Comment

by:Dnx_7
ID: 19662142
hi,
you meant in the "NEW" constructor of the form?

if yes, then the initialize component doesn't throw exception but just after the "new" constructor, the exception is thrown...

regards
0
 
LVL 7

Accepted Solution

by:
multithreading earned 2000 total points
ID: 19663322
No, I really meant the class level initialization, not the object constructor; something like this:

static MyOtherClassThatThrowsAnException trouble = new MyOtherClassThatThrowsAnException();
// or this
static int uninitialized[];
static MyClass()
 {
     uninitialized[0] = 1;
 }

would cause this trouble.

But, for your specific case I see that you didn't write the DLL you are referencing, and perhaps you don't have BOTH DLLs required for what you are tring to do. There is a .Net DLL which is an intermediate layer for working the C DLL you are trying to use. It could be that the .Net DLL is having trouble (in it's static initialization) hooking up with the magic DLL. Make sure both DLLs are where they are supposed to be.
0
 
LVL 7

Expert Comment

by:multithreading
ID: 19826572
The source of the exception was identified in the answers.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Loops Section Overview
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question