OpenNetCF.NET.dll, TypeLoadException / MissingMethodException

K

Kath

I have a VB.net project, for PPC 2003 on the XDA II. I am trying to
add functionality in my application to automatically reconnect GPRS if
it disconnects, and monitor it's state, etc. I am trying to use a
reference to OpenNETCF's connection manager.

I've managed to add a reference to the OpenNETCF.Net.dll, and my
project works with the added references (openNETCF.Net.dll and
mscorlib). However, I have the following problems if I try to declare
an instance of the opennetcf:

1) In my global declarations module, I add the declaration:
"Public GPRSconn As New OpenNETCF.Net.ConnectionManager".
When I try to run the project, it crashes on my form's class (before
opening the form), with a MissingMethodException (in myproject.exe).

2) I move the declaration to my first form, declaring it locally in a
sub (I need it as a global variable, but I was just trying to get it
to work!). The form loads fine. When I click on my button, it crashes
on the
line which calls my sub to declare the GPRSconn, with the exception:
TypeLoadException (in myproject.exe).

ie.

Private Sub TrytoDecGPRS()
Try
Dim GPRSconn As New OpenNETCF.Net.ConnectionManager
MsgBox(GPRSconn.State.ToString)
Catch ex As Exception
MsgBox("intro(tryGPRS): " + ex.Message)
End Try
End Sub

Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLogin.Click
TrytoDecGPRS()

It crashes on the line "TrytoDecGPRS()"

Am I not declaring the opennetcf correctly? Am I missing something?
Any help greatly appreciated!

Thanks,
Kath
 
J

Jon Skeet [C# MVP]

Kath said:
I have a VB.net project, for PPC 2003 on the XDA II. I am trying to
add functionality in my application to automatically reconnect GPRS if
it disconnects, and monitor it's state, etc. I am trying to use a
reference to OpenNETCF's connection manager.

I've managed to add a reference to the OpenNETCF.Net.dll, and my
project works with the added references (openNETCF.Net.dll and
mscorlib). However, I have the following problems if I try to declare
an instance of the opennetcf:

You need to add a reference to OpenNETCF.dll as well, and make sure
that whatever deployment solution you've got copies that to the device
as well as OpenNETCF.Net.dll.
 
K

Kath

Thankyou! It works fine now.

In a way it's annoying (and embarrassing :) that I didn't think to try
that, but at the same time I'm glad it was so simple to fix!

Thanks Jon!
 
J

Jon Skeet [C# MVP]

Kath said:
Thankyou! It works fine now.

In a way it's annoying (and embarrassing :) that I didn't think to try
that, but at the same time I'm glad it was so simple to fix!

No problem. It's just lucky that I ran into the same issue yesterday :)
 

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