Application quit when i set ProgressBar.Minimum and ProgressBar.Maximum with the same value

  • Thread starter Thread starter Cheetah
  • Start date Start date
Are you setting this property directly from a non-UI thread? This is likely
to cause that behaviour.

Peter
 
I do not create a non-UI thread. Just a simple app, a form with a
progressbar and a button. Onbutton click i set progressbar.maximum and
progressbar.minimum with the same value, 50 for example. When i run
the app, after button click, app will quit.
 
hi all,

I'm sure this is a bug of .NET compact framework. You can experiment
as follows:
- put 1 progressbar1 on form
- put 1 button1 onform
-OnButton1_click:
progressbar1.minimum = 10
progrssbar1.maximum = 10
- click button1, application exited!!!!

That means if you set maximum equals mimum of progress bar and after
that, do not change maximum value again, application always exit
without any warning, exception.
I'm also testing with SP2 and it is the same.
Last but not least, I don't know whether there are other bugs like
this somewhere!!!

Cheers,
Khanh
 
Exact code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Try

Me.ProgressBar1.Minimum = 10
Me.ProgressBar1.Maximum = 10
Catch ex As Exception
Dim a = 0 --> no come here
End Try
End Sub

FYI: Pocket PC Fujitsu Loox FLX3AW

Khanh
 
I cannot reproduce this on the PPC2003 or the emulator. Are you using a
localized build by any chance?
 
I don't understand what you means by "localized build", but I'm using
VS.NET 2003 English version, Pocket PC Fujitsu, OS Japanese version.

Is it likely by specific device type?

Have fun
Khanh
 
This is exactly what I mean - Japanes build of OS - it *may* be significant.
It is not unheard of for a localized OS build to behave differently.
Does this problem occur for you on the emulator?
 
wow, this does not happen on emulator Pocket PC SDK Japanese version.
By the way, let me tell you my "headache package" that really makes me
stressed, would you like to take a look?

- The app is existed suddenly without any exception.
- 1 time, it crashed and hung out PDA. I must soft-reset.
- Calling web service frequently lost connection. Average of 1/20
times.

This makes our client really worried, and I don't know how to solve.
Below is a snippet of pseudocode on form that often happens the
phenomena above:

'get request list from webservice, dasRequestNoList is reference
dataset. "Request" means a package of data (from many tables) need to
get.
ws.GetRequestNoList(ar, dasRequestNoList)
'loop through request list to download each request info from server
by webservice then insert into SQL CE
For i As Integer = 0 To intTotalRequest - 1
ws.GetOneRequest(dasOneRequest)
'report to report text box control by P/Invoke SendMessage,
increase progress bar.
txtDownloadProgress.Focus() 'textbox control
pTB = GetFocus() 'pTB is InPtr type
SendMessage(pTB, EM_REPLACESEL, 0, "info about request")
pgbDownloadProgress.Value += 1 'progress bar
Next

I would like to ask:
- Is there any problem of snippet of code above?
- Is there any limitation of data size for PDA? In my case, my SQL
CE database must be approximately 50 MBs, and every day must get
around 5 MBs from server (also clear old data in SQL CE). Does anyone
have experience to resolve processing large data in PDA?
- Lost connection when calling webservice? It is also a paramount
problem!
- Last but not least, speeding up the transfering of data by
webservice is also a very long discussion.

Thanks in advance,
Nguyen Truong Khanh



Alex Feinman said:
This is exactly what I mean - Japanes build of OS - it *may* be significant.
It is not unheard of for a localized OS build to behave differently.
Does this problem occur for you on the emulator?

--
Alex Feinman
---
Visit http://www.opennetcf.org
Khanh said:
I don't understand what you means by "localized build", but I'm using
VS.NET 2003 English version, Pocket PC Fujitsu, OS Japanese version.

Is it likely by specific device type?

Have fun
Khanh

"Alex Feinman [MVP]" <[email protected]> wrote in message message
This is
likely
 
I update a process bar while doing lots of web service calls, but I do it
using a delegate rather than P/Invoking to update the progress bar.

Basically I have a class that is responsible for doing the synchronisation
of our database onto the Pocket PC SQL CE database and the constructor
requires that you pass it a 'ProgressDelegate':

public delegate void ProgressDelegate(int step,int numSteps,string message);

Then, whenever the synchronisation code wants to update the progres bar it
just does:

if (progressDelegate != null) ProgressDelegate(step,numSteps,"Hello world!");

The calling code implements the delegate like this:

protected void MyProgressDelegate(int step,int numSteps,string message)
{
progressBar.Min=1;
progressBar.Max=numSteps;
progressBar.Value=step;
progressLabel.Text=message;
}

Forgive any typos in the code, I just typed it in rather than cut/paste,
but you get the idea.

Hope this helps!

Richard
 
There could be a problem if the pseudocode below is invoked on a secondary
thread (from a timer callback or another asynchronous call). In that case
you will experience random crashes. To avoid it, use Control.Invoke.

Losing connection when calling web service is possible. It was greatly
helped by SP2, so make sure you use it.
The database size should not be a problem, but make sure to compact it
frequently.

Speed of data transfer using the web service is a problem. THe way around it
is downloading data using HttpWebRequest and processing it on the client
 
Thank you for posting this. We were fighting this same problem. Yes,
we have seen the abrupt ending of our application when you set the min
and max value of a progress bar to the same value (zero for us).

We experienced it on a PPC 2003 device (Dell Axium and a Symbol MC9000),
but the code works fine in our PPC 2002 devices.

Tom
 
This is just a sample, we still experience other cases of ending but
we don't know why. Should we share the knowledge if we comprehend any
thing new?

Khanh
 
Khanh,

If we learn anything new about this bug in the Compact Framework, I'll
certainly let everyone know!

We haven't hit that exact symptom (the abrupt ending of the application) in
response to any other errors that we know of yet.

The only information I have is that the code works in PPC 2002 device, but
fails in the two PPC 2003 devices we tried. At least this particular bug
can be coded around once you know what to look for.

Good luck with your application!
Tom
 
I too face a similar problem while invoking the ie from my vb application. I
use ie to show the help to my pda application. I am tracking the exception.
Application closes without raising any error. My code is attached.

help me to solve this.

public class Help
{
[DllImport("coredll.Dll", EntryPoint="CreateProcess", SetLastError=true)]
extern static int CreateProcess(string strImageName,
string strCmdLine,
IntPtr pProcessAttributes,
IntPtr pThreadAttributes,
int bInheritsHandle,
int dwCreationFlags,
IntPtr pEnvironment,
IntPtr pCurrentDir,
IntPtr bArray,
ProcessInfo oProc);
private class ProcessInfo
{
public Int32 hProcess;
public Int32 hThread;
public Int32 ProcessID;
public Int32 ThreadID;
}
public static void showHelp(string strScreenId)
{
try
{
//strScreenId = "Top";
ProcessInfo priProcessInfo = new ProcessInfo();
CreateProcess("iexplore.exe",
"#" + strScreenId,
IntPtr.Zero,
IntPtr.Zero,
0,
0,
IntPtr.Zero,
IntPtr.Zero,
IntPtr.Zero,
priProcessInfo);
}
catch(Exception expException)
{
string strExpMessage = expException.Message.ToString();
}
}
}
 
Since Pocket PC automatically closes applications if memory is low, it may
be closing your app when it is deactivated, whats the memory usage like when
your app is running? Do you have any other apps running in the background?

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups

Suresh said:
I too face a similar problem while invoking the ie from my vb application.
I
use ie to show the help to my pda application. I am tracking the
exception.
Application closes without raising any error. My code is attached.

help me to solve this.

public class Help
{
[DllImport("coredll.Dll", EntryPoint="CreateProcess", SetLastError=true)]
extern static int CreateProcess(string strImageName,
string strCmdLine,
IntPtr pProcessAttributes,
IntPtr pThreadAttributes,
int bInheritsHandle,
int dwCreationFlags,
IntPtr pEnvironment,
IntPtr pCurrentDir,
IntPtr bArray,
ProcessInfo oProc);
private class ProcessInfo
{
public Int32 hProcess;
public Int32 hThread;
public Int32 ProcessID;
public Int32 ThreadID;
}
public static void showHelp(string strScreenId)
{
try
{
//strScreenId = "Top";
ProcessInfo priProcessInfo = new ProcessInfo();
CreateProcess("iexplore.exe",
"#" + strScreenId,
IntPtr.Zero,
IntPtr.Zero,
0,
0,
IntPtr.Zero,
IntPtr.Zero,
IntPtr.Zero,
priProcessInfo);
}
catch(Exception expException)
{
string strExpMessage = expException.Message.ToString();
}
}
}

Cheetah said:
Anyone here had the same problem with me, or this is Microsoft .NET CF
bug?
 
Peter,

Yes. I was getting outofmemory error in emulator.
What do u mean my application getting deactivated. I am showing a help page
in ie and application is windows based (vb)
I am not sure how to check the memory usage in PDA.(Win CE 4.2)

Peter Foot said:
Since Pocket PC automatically closes applications if memory is low, it may
be closing your app when it is deactivated, whats the memory usage like when
your app is running? Do you have any other apps running in the background?

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups

Suresh said:
I too face a similar problem while invoking the ie from my vb application.
I
use ie to show the help to my pda application. I am tracking the
exception.
Application closes without raising any error. My code is attached.

help me to solve this.

public class Help
{
[DllImport("coredll.Dll", EntryPoint="CreateProcess", SetLastError=true)]
extern static int CreateProcess(string strImageName,
string strCmdLine,
IntPtr pProcessAttributes,
IntPtr pThreadAttributes,
int bInheritsHandle,
int dwCreationFlags,
IntPtr pEnvironment,
IntPtr pCurrentDir,
IntPtr bArray,
ProcessInfo oProc);
private class ProcessInfo
{
public Int32 hProcess;
public Int32 hThread;
public Int32 ProcessID;
public Int32 ThreadID;
}
public static void showHelp(string strScreenId)
{
try
{
//strScreenId = "Top";
ProcessInfo priProcessInfo = new ProcessInfo();
CreateProcess("iexplore.exe",
"#" + strScreenId,
IntPtr.Zero,
IntPtr.Zero,
0,
0,
IntPtr.Zero,
IntPtr.Zero,
IntPtr.Zero,
priProcessInfo);
}
catch(Exception expException)
{
string strExpMessage = expException.Message.ToString();
}
}
}

Cheetah said:
Anyone here had the same problem with me, or this is Microsoft .NET CF
bug?
 
Back
Top