quit unexpectedly

K

KNC

hi all,

Our app got a long-term headache bug, that is our App sometimes quit
unexpectedly without any warning. We heard that if installing SP3,
everything is OK. But that's not true. Even installing SP3, our app
still quit.
We use a tool for automatically test 1 event load form, and write to
log file to check in detail. The test report is as follows:

1) Hardware
PDA Client machine: Pocket Loox/ FLX3AW
CPU: Intel PXA 255 400MHz
Memory: RAM 128M and ROM 64 M
OS: Window Mobile 2003 software for Pocket PC
Database: MS SQL CE

2) Software
Test: Pocket PC Controller Professional Version 4.12
Delopement: VB.NET compact framework

3) Metrics
Total number tests: 250
Total number of quiting unexpectedly: 18
Test place: event load form of a specific form

4) Average Memory(GlobalStatusMemory API function)

MemoryLoad: 46
TotalPhysical: 51.859375
AvailablePhysical: 28.21875
TotalPageFile: 0
AvailPageFile: 0
TotalVirtual: 32
AvailVirtual: 22.4375


5) Result
It quit in any place in load form event, even at the end of
function Load_Form

We think of 4 capabilities:

- Our App has a serious bug ?
- Memory isn't enough ?
- Window Mobile 2003 has a problem ?
- Pocket PC Fujitsu device has a problem


Any help to light up for us?
Thanks,
KNC
 
M

McFar

Hello, I have the same problem and found a ay to fix it, in my application
it was because of
PInvoke to native functions. :)

Does your application PInvoke to native functions? If does, so try to find
out another solution to avoid PInvoke
 
G

Guest

Or use exception handling. There's no reason top avoid P/Invokes just
becasue you fear them.

-Chris
 
M

McFar

I am not sure that exception handling will help here....
I posted an example of simple application here a couple of weeks ago, that
does nothing just PInvokes huge number of times in a row
and the application just disappeared, none exception, none message, just
disappeared....
So I supposed that it is a PInvoke problem and replaced all the PInvoke
calls onto managed
functions, the application works fine now...
 
P

Peter Foot [MVP]

If the function you are P/Invoking has a direct managed equivalent then of
course you should use that instead, but especially with the Compact
Framework there are times when you need to use P/Invoke because the
functionality is not included in the standard class libraries.Do not forget
that at some point all of the managed classes are calling down to the
underlying OS for their functionality.
There are a couple of possible reasons why your app may die under continuous
P/Invoking, perhaps your P/Invoke definitions are wrong, perhaps you are not
correctly handling an error condition, or perhaps you are not correctly
allocating or freeing native memory. If you can pinpoint a specific function
then post your P/Invoke declaration and code snippet of it in use and we can
advise further.

Peter
 
G

Guest

Depends on usage. You can catch some exceptions with P/Invokes (like
MissingMethodException). In other cases you have to be careful with
parameters. Keep in mind that even the Microsoft pieces of the CF contain a
*lot* of P/Invokes, since that's how you call native APIs. So while you
think you've "replaced all the P/Invoke calls" you've likely just move the
location of the P/Invoke out of your own code, but it's still happening.

Unexpected shutdowns with no warning or error are usually due to a
low-memory condition and the PPC shuts you down.

-Chris
 
K

KNC

Hi all,

First of all, thanks for your all reply.
Regarding P/Invokes, we use a lof of this feature in our app and that's
OK. The event load form of our test form has no P/Invokes at all.
For "low-memory condition and the PPC shuts you down", I heard much
about this and you can see the memory report, the available virtual
memory is 22 MBs approximately, so that can not be this case. Moreover,
our app even quit suddenly once just launch it.

Any help would be very appreciated,
Kindly regards,

KNC
 
M

McFar

There are a couple of possible reasons why your app may die under
I used to reproduce the problem using different API
here is another new way to play hide and seek.

private void button1_Click(object sender, System.EventArgs e)
{
try
{
OpenNETCF.Win32.RegistryKey reg =
OpenNETCF.Win32.Registry.ClassesRoot;
int i = 0;
while(i < 500)
{
string[] keys = reg.GetSubKeyNames();
i++;
keys = null;
}
}
catch(Exception eh)
{
MessageBox.Show(eh.Message);
}
}

Be patient and u get an apple :)
It fails occasionally, but it will....

Once, it was long ago, I got this error message
ExceptionCode: 0x80000002
ExceptionAddress: 0x0159FEC0
But it was only once.

So having all this happiness, I removed all PInvoke from my application.
 
G

Guest

Again, available memory is a misnomer ic CE. You could have 100 MB "free"
and stuill run out of vitual space for your process. This is actually
fairly common on newer PPC devices that load all kinds of vendor stuff
(apps, utilites, etc) at boot. For a good explanation, Google "Boling CE
advanced memory" and read the resulting MSDN article.

-Chris
 
K

KNC

Hi Chris,

As I talked beforehand, the available virtual memory is 22 MBs
approximately, so the problem "You could have 100 MB "free" and stuill
run out of vitual space for your process" can not be the case. I assume
that I also have knowledge about PPC memory via famous articles from
Douglas Boling.
Could you tell me another reasonable manner?

Thanks,
KNC
 

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