Re: Application xxx has encountered a serious error and must shut



You'll get a trappable managed exception like ObjectDisposedException in
that case.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com



"Rob" <__rob_AT_robtso_DOT_nl__> wrote in message
news:2892B770-E4DE-4816-B755-8C906BCCB618@xxxxxxxxxxxxxxxx
Thread 2 could reference an object, deleted by thread 1....
But I guess this is no so much a problem in C#.

Kind regards,
Rob
www.robtso.nl

"Chris Tacke, eMVP" wrote:

An access violation is unlikely to be caused by thread issues. It's
being
caused by someone accessing memory they don't have ownership of, and in
managed code that's really hard to do. Are you using unsafe code
anywhere?
P/Invokes using handles (IntPtr, int, uint, GCHandle or otherwise)?

I'm betting this is not a thread issue, but a compaction issue. You've
got
some buffer that was passed to native code, then that buffer gets moved
by
the GC and the native code tries to use the old buffer address.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com




"GrahamS" <GrahamS@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F23FBD0A-E81B-44B6-88D7-A9BA3D87440D@xxxxxxxxxxxxxxxx
Rob,

Thanks for the feedback.

I am building my own NK.BIN file - although I wish I was not having to
do
that :-O - its yet another layer of complexity I could do without
;-)) -
but
I guess that it does give me greater control over the final product....

I am running a search right now - although I 'suspect' that it might be
in
the CF code. I just saw my Com1 port - I had left it connected, and it
shows
a lot of entries like :

Exception 'Access Violation' (14): Thread-Id=05170002(pth=87270854),
Proc-Id=051
60002(pprc=87270564) 'EmsAppCE.exe', VM-active=05160002(pprc=87270564)
'EmsAppCE
.exe'
PC=40bf7e9c(mscoree3_5.dll+0x00047e9c)
RA=40bf8256(mscoree3_5.dll+0x00048256) SP
=0004ee68, BVA=555555a8
Exception 'Raised Exception' (-1): Thread-Id=05170002(pth=87270854),
Proc-Id=004
00002(pprc=812a7800) 'NK.EXE', VM-active=05160002(pprc=87270564)
'EmsAppCE.exe'
PC=c00338b1(k.coredll.dll+0x000138b1)
RA=c0033901(k.coredll.dll+0x00013901)
SP=d
1ecefc8, BVA=ffffffff

EmsAppCE.exe is my managed code app - but these exceptions are down in
mscoree and k.coredll :-O. Without runtime access to a debugger, I
don't
know
how to find where this is in my code ;-O.


This has made me start to look even harder at my code though -
especially
my
use of Queue<string> across multiple threads - and even my exception
logging
mechanism - may need to beef up the thread-safe functionality here a
little
as well ;-).

I am also adding an application-level 'UnhandledException' handler - as
I
originally thought that just a try-catch around the Form.Run would have
done
that - but I guess not - if the exception is from another managed
thread
etc....

Its strange because I originally saw this type of failure back in
January
but it seemed to be coming from my Socket Layer code :-O. Recently its
stopped my Serial port thread - last time it stopped the whole app :-O.

Thanks for the feedback though - helps keep me on the right track (and
sane
I hope!) ;-).

Trouble is that I hate 'guesswork' (like try this and see if it fixes
it) -
I'd much rather be able to understand exactly what is going wrong -
then
fix
it. Gives far more long-term confidence in my code :-O.

Regards

Graham


"Rob" wrote:

Do you build apps using an SDK, or also create your own CE image ?.
If you can debug your image, it should not be so hard to find where
the
dialog comes from. Messageboxes are very rare in kernel/driver parts
of
the
system.
A simple search trough the CE sourcecode-tree might already identify
it.
(assuming it comes from the OS)
Don't know how this applies to the sourcecode of the C# libraries...

Kind regards,
Rob
www.robtso.nl



"GrahamS" wrote:

Hi,

I have a CE application which runs pretty well on a number of
embedded
PC's
(eBox 2300sx).

I am experiencing seemingly random failures however - some appearing
days
after the application is started. These put up a dialog with the
above
message (xxx is my app name).

Similar messages have also reported this as being in 'udevice.exe'.

My app is a Managed C# CF3.5 app and makes extensive use of a TCP
Socket and
a serial port (Com2).

My app has a full set of exception handlers - with some wrapping
threads,
and one wrapping the whole app - but none of these are triggered
when
this
dialog pops up.

1. How do I identify what is causing this dialog ??.

2. How do I prevent it from occurring. There is no user - its a
remotely
located device with no screen, keyboard or mouse and MUST run 24x7
completely
unattended. There is a UI but for 'diagnostic' purposes only - plug
in
a
screen and see what the device is doing.

I would make it a full 'windows service' if this were a PC - but its
CE
:-O.

My app is run from within a command file so that IF it were to crash
out -
it just gets restarted - this all works until the OS puts up this
dialog box
:-O - then one of my threads stops (serial port) until the OK button
is
pressed.

This is making me wonder if I really should be using CE for this
project at
all :-((.

I cannot really 'instrument' this any further as adding KITL
prevents
me
from using the serial and ethernet ports - on which my app is based.
It
also
completely changes the footprint of the device and thus may even
mask
the
issue anyway ??.

It 'looks' to me like an exception outside of my own code - maybe in
the
'managed wrappers' ??.

This one has been driving me nuts for many weeks now as I cannot get
to
the
bottom of it - especially as the error message is SO unhelpful!.

NB I replaced the MS SerialPort with OpenNetCF Serial and this seems
to
have
made the occurrence rarer - I thought it had gone away - but
yesterday
it
came back again after running perfectly for a few days :-O.

Finally - it does not appear to happen on ALL boxes - although this
may
well
be a 'red herring' - ie there could be other code changes introduced
whilst
trying to instrument the problem to locate it ;-O.

I am even now getting to the stage of questioning whether CE is the
right
choice here - if it can put up a show-stopper like this. My eBox has
128M RAM
so maybe I should be thinking about Embedded XP or some other OS
?? -
ie one
which has better support for 'services'.

Thanks hopefully.

Regards

Graham






.


Quantcast