How to debug System.MissingMethodException errors?

  • Thread starter Thread starter PocketDeveloper
  • Start date Start date
P

PocketDeveloper

What is the process for debugging a System.MissingMethodException
error?


I am using vb.net in the Compact Framework.

Mine appears in a Mousedown event, but if I wrap a Try/Catch in that
code, a System.MissingMethodException error then appears at the
Application.Run(New Form1) level., with a green triangle pointing to
this line when debugging.

There is no code that "triggers" the error in this case; it has jumped
up to the application level, correct?

If a wrap a Try-Catch around Application.Run, then I get the same
error, only now it adds that there is NO code that can be stepped
into.

So, how do you systematically debug such an error?

Do you look for duplicate .DLLs or assemblies, perhaps?

I search on groups for information on this error, and people don't
ever seem to know how to systematically debug it...
 
Most probably this exception is related to P/Invoke.
Are you calling any API's?
 
Alex Yakhnin said:
Most probably this exception is related to P/Invoke.
Are you calling any API's?

No. Not calling any APIs.

And there is this: there is no error if the code in the button click event is

Form1.Show()
Me.Hide()

It will work, and show Form1.

BUT if the code in the button Click is

MsgBox("Test")

then I get the System.MissingMethodException in System.Windows.Forms.dll

This must be a good clue to someone who knows more than I do.

Any ideas??
 
I was getting the same error in C#. I fixed it by using the Invoke
command. I am updating a DataTable which is a datasource of a
DataGrid. I was just directly calling the procedure that updated the
DataTable. This was causing an exception outside my code, like you
are getting. It has something to do with accessing a form component
from your thread that doesn't "own" the component.

Here is what fixed it for me:

Define the procedure that does the updating like this:
public void UpdGrid_handler(object sender, EventArgs evArgs)

Whenever you need to update the grid, use a line like this:
grid.Invoke(new EventHandler(UpdGrid_handler));

Hope this helps,
Mick
 
I can't help you solve this problem, but you are definitely not alone. I have a couple of Windows Forms applications where I am now randomly getting "A managed MissingMethodException occurred" at my first Form Load in Application::Run. I'm not doing any P/Invoke, or datagrid. All I'm doing is reading a file to initialize some variables for my application

The error doesn't happen in any predictable pattern, it only happens about once every 10 or 20 times I start the application. It doesn't occur on the emulator, just my Windows CE device. I haven't been able to get rid of it, and adding more debug code to the beginning of my application hasn't given me any insight. I'm not sure what I could rewrite to avoid it, or what I'm going to try next

I was going to post my problem, but it looks like I'd get about the same replies that you did.
 
Back
Top