MissingMethodxception

A

Alessandro

Hi everybody,

I have a TCP/IP communication library working fine on PC.
I am trying to use it on a PocketPC application. I have simply referenced
the communication library project and build the application.
The application start but calling some method it stops giving a
"MissingMethodException".

Since I have no more ideas to resolve the problem I will try to describe
situation in details.

I had different results:
1- In a first test application calling the "Connect" method I had a
"MissingMethodException" both in Pocket PC and in the emulator
2- In a second test application (different work space) the call to "Connect"
works fine. But I have the same error on the method "Send"
3- I have imported the first test application in the second application
workspace. "Connect" works fine but "Send" gives the exception
4- In a third test application (different work space) I have the same errors
of points 2 and 3.

A have the following code (I have simplified it)

public abstract class BaseClient
{
public abstract void Connect(bool flag);
public void Connect() {Connect(true);}
protected abstract void Send(...);
protected byte[] Transact(...)
{
....
this.Send(...)
}
......
}

public abstract class ModbusClient : BaseClient
{
public void Write(.....)
{
.....
.... = Transact(...);
......
}
}

public class ModbusTcpClient : ModbusClient
{
public override void Connect(bool flag)
{
....
}
public override void Send(...)
{
....
}
}


// Pocket PC Application

{
.....
ModbusTcpClient tcpclient = new ModbusTcpClient (....)

tcpclient.Connect(); // MissingMethodException calling
BaseClient.Connect()
// Exception in first
application......works fine in second application
tcpclient.Write(....); // MissingMethodException on
BaseClient.Transact() calling BaseClient.Send()
// Exception in all application

......
}

Thank you for any help

Alessandro
 
D

Daniel Moth

Was this library compiled for the CF? A desktop library is not retargetable.

Cheers
Daniel
 
C

Chris Tacke, eMVP

Desktop managed assemblies are not retargetable to the device. They must be
recompiled (and often reworked to use a smaller API set). Desktop unmanaged
binaries won't work at all because they're compiled for the wrong processor,
are linked against libraries that don't exist in CE and usually use APIs
that don't exist in CE.
 
A

Alessandro

Yes, I have recompiled the DLL for CF. All code is managed (C#).
The strange thing is that an application that uses the library (method
"connect") gives an exception.
The same application build from an other VS solution do not give the
exception.
Anyway all applications gives an exception (MissingMethodException) calling
the method "Send"..

Since code uses inheritance in depth and contains some calls to virtual
methods (see my first mail), my idea is that the problem arises during
linking of virtual methods. Do you think so?

Thank you
Alessandro

Chris Tacke said:
Desktop managed assemblies are not retargetable to the device. They must
be recompiled (and often reworked to use a smaller API set). Desktop
unmanaged binaries won't work at all because they're compiled for the
wrong processor, are linked against libraries that don't exist in CE and
usually use APIs that don't exist in CE.

--
<ctacke/>
www.OpenNETCF.org
Your CF searches start and end here


Alessandro said:
Hi everybody,

I have a TCP/IP communication library working fine on PC.
I am trying to use it on a PocketPC application. I have simply referenced
the communication library project and build the application.
The application start but calling some method it stops giving a
"MissingMethodException".

Since I have no more ideas to resolve the problem I will try to describe
situation in details.

I had different results:
1- In a first test application calling the "Connect" method I had a
"MissingMethodException" both in Pocket PC and in the emulator
2- In a second test application (different work space) the call to
"Connect" works fine. But I have the same error on the method "Send"
3- I have imported the first test application in the second application
workspace. "Connect" works fine but "Send" gives the exception
4- In a third test application (different work space) I have the same
errors of points 2 and 3.

A have the following code (I have simplified it)

public abstract class BaseClient
{
public abstract void Connect(bool flag);
public void Connect() {Connect(true);}
protected abstract void Send(...);
protected byte[] Transact(...)
{
....
this.Send(...)
}
......
}

public abstract class ModbusClient : BaseClient
{
public void Write(.....)
{
.....
.... = Transact(...);
......
}
}

public class ModbusTcpClient : ModbusClient
{
public override void Connect(bool flag)
{
....
}
public override void Send(...)
{
....
}
}


// Pocket PC Application

{
.....
ModbusTcpClient tcpclient = new ModbusTcpClient (....)

tcpclient.Connect(); // MissingMethodException calling
BaseClient.Connect()
// Exception in first
application......works fine in second application
tcpclient.Write(....); // MissingMethodException on
BaseClient.Transact() calling BaseClient.Send()
// Exception in all application

......
}

Thank you for any help

Alessandro
 

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