Unhandled exceptions and low memory problems

L

Lonifasiko

Hi group,

My program sometimes terminates unexpectedly and of course, application
is closed. Well, after reading many posts, I finally found the
workaround from Daniel Moth.

Now, I think I "catch" all unhandled exception my system throws. As far
as I understand, when
"OnUnhandledException(Object sender, UnhandledExceptionEventArgs e)"
method is called, there is no way to avoid the application from being
shutted down. That is, if e.IsTerminating is true, be sure that
application will be closed, no matter yuou show a messagebox to block
the execution and so on....is this correct?

I wanted to know if memory problems can raise unhandled exceptions?
That is, many months ago I saw "OutOFMemoryException" messagebox in my
application, but after coding again some things I was not doing well,
this message dissapeared.

My application almost crashes in devices with 64 Mb RAM. The way I'm
"handling" unhandled exceptions would also capture OutOfMemory
exceptions? Or "OutOfMemoryException" messagebox is different? That is,
if my application should have low memory problems, I should see this
messagebox appart from my unhandled exceptions catching block?

I use FMODCE.DLL to play MP3 and WAV in my application. These unhandled
exceptions seem related to using this library for playing sounds. Has
anybody experienced this kind of problems with this library? Seems like
this library works well in Windows Mobile 2003 devices, but in some
cases, always in Windows Mobile 2003 Second Ediitond devices, I get
"cannot pinvoke fmodce.dll". It's really strange cause fmodce.dll is
placed in the directory the main .exe is.

Hope somebody can help me. Thanks very much in advance.
 
L

Lonifasiko

I think I don't see this unhandled exceptions issue clear enough.......

In order to test how application behaves, I have set timer1 to null and
then timer1.Enabled = True

Deployed the application and the only thing I can see is that
application exits (this is normal!), but wihout a messagebox, wihout
logging the error in the .txt it should......

OnUnhandledException event is not being correctly raised???

Need some info around this. Would be very useful for me to hav the
stack trace in a .txt file, but seems like this way I cannot get the
unhandled exception.

Thanks very much in advance.
 
D

Daniel Moth

You seem to be mixing a few questions in your post(s) but to nail the main
question on unhandled exceptions, please post a small repro that
demonstrates the handler not firing - then one of us can look at it.

Cheers
Daniel
 
L

Lonifasiko

Hi Daniel,

Thanks for your reply and sorry for mixing issues in my post. It was my
fault. I finally noticed that the event was firing properly.

I think my problem is a timer that plays at regular intervals an audio
file wth FMODCE music library. This library seems to be firing an
unhandled exception.

With unhandled exceptions like these, appart from logging the error in
a text file for support purposes, is there anything else we can do?
I've read in your post that a fatal error message would be swaolled
because application needs closing. In my case, maybe would be useul to
perform a soft-reset to the device so that application is started again
on startup. Would this soft-reset command have success? Or would be
swallowed too?

A low-level memory problem would fire this event or I should see a the
typical messagebox I've seen other times?

Thanks very much in advance.
 
S

Scott Ayton

In response to your comment on Pinvoking sometimes not working, i have
experienced this behaviour in our application as the application itself
uses alot of memory and on occasion the pinvoke would just fail.

In our particluar case we were Pinvoking to turn on/off the bluetooth
radio using IpaqUtil.dll and the workaround at the time was to turn it
on when the application boots up and has not used up as much
memory/resources. This works fine but means that the battery drains
quicker as the radio is always on instead of the few brief instances it
needs to be.

Most of our memory problems have been solved by upgrading PDA's to WM5,
ofcourse this caused some other problems (although somewhat smaller)
aswell.

As far as i am aware you can not abort an unhandled exception shutdown,
all we do is write out a bit of debug information to a txt file. I
would say you are able to reboot the device during that time however.
 
D

Daniel Moth

It's been a long time since I played with this area (as you can tell by the
timestamp on my blog entry) but...
As far as i am aware you can not abort an unhandled exception shutdown,
all we do is write out a bit of debug information to a txt file. I

....I think I agree with this *but* I haven't tried to (dis)prove it...

would say you are able to reboot the device during that time however.

....can't see a problem with that either. Any short lived activity is game
IIRC.


Cheers
Daniel
 

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