Windows CE 4.1 TypeLoadException or Fatal Error

N

Nick

We have written a very simple application in VB.NET that uses the .NET
Compact Framework (SP2). The application reads a product barcode, looks
it up in a database and shows the price on the screen. The device we
are targeting is the Symbol MK1100 which has Windows CE 4.1 installed.

We have set up the CE device so that it installs the .NET Compact
Framework and relevant Symbol Assemblies as it boots up. Then we launch
our application as the final step.

Following a cold boot, approximately 1 in 3 times, as our application
starts it yields a variety of random error messages such as "Fatal
Application Error" or a number of different "TypeLoadException"
errors claiming various .NET assemblies are missing (which ones are
missing seem to be completely random). This problem can sometimes be
resolved by simply restarting our application.

For several days now we have tried many, many things, and have no more
ideas. For example we are running the application from the \Program
Files directory and NOT the \Application directory as we understand
running applications from non-volatile flash memory could cause
instability. We have also tried adding a delay of 15 seconds before our
application begins in case there is some timing issue - again this
makes no difference.

Whatever the problem is it seems that the programs installed on boot -
i.e. the CF, Symbol Libraries etc are not being properly registered in
the GAC or installed correctly. We've even tried putting the DLLs in
the application directory but it makes no difference.

Any ideas would be greatly appreciated.

Thanks
Nick Thompson
DCSL Internet Ltd
 
P

Paul G. Tobey [eMVP]

You're probably running the program before the OS is ready to respond to
some of the calls that the run-time for .NET CF uses. The only way I've
seen to work around this is to just wait a while before starting the
program. Obviously, if the program is counting on, say, a given storage
card to be mounted or something, you want to check that before actually
trying to use it and, in that case, make sure that the file system is up and
running, but there's no one answer to 'how do I have a .NET CF program run
on startup'.

Paul T.
 
N

Nick

Hi Paul,

I did set a 15 second delay before starting my app, but it didn't seem
to make any difference. The processor is an ARMV4 200Mz. Do you think
15 seconds may not be enough? I don't care - it can be 10 minutes as
long as I can get it working!

Thanks for your help with this.

Regards
Nick
 
P

Paul G. Tobey [eMVP]

I'd try something that you know is ridiculously long, a minute, say. If
that does fix the problem, then you can, maybe, adjust the delay...

Paul T.
 
N

Nick

Hi Paul,

I tried adding a 1 minute delay. I cold booted the device about 3 times
and it worked great. On the 4th boot I got a TypeLoadException and it
said:

Could not load type
System.ComponentModel.Component
from assembly System,
Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=969DB8053D3322AC.

The error above is just one of similar errors I get with this,
sometimes later on in the application (for example I often see it
complaining it's missing stuff from System.Drawing or the
Symbol.Barcode assemblies) and sometimes so early on I just get a Fatal
Error (so I guess essential .NET CF error handling assemblies are not
available).

I am really stumped with this. Have you any more ideas about what might
be causing this weird intermittent problem?

Thanks again,
Nick
 
P

Paul G. Tobey [eMVP]

No, I'm afraid not. I don't launch this type of application from, say, the
Startup folder. If I had to run a managed code application at boot-time,
I'd write an unmanaged application to do the launching. However, I've never
seen a 1 minute delay in readiness. You could try running it manually from
File Explorer early on after boot and seeing if that, too, intermittently
fails...

Paul T.
 
N

Nick

OK - Thanks Paul.

If anybody else has this same problem and finds a solution please post
it to this topic.

In the meantime I'm going to re-write the app as a browser based
solution!
 

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