Hello .Net enthusiasts. I have a problem with a Mobil Application I'm
developing on the Windows CE 5 platform. The application will crash
eratically without displaying debugging info usually when loading a
separate form using show and hide methods. I placed try/catches on all
the code blocks I thought would contribute to the crash, but have not
solved the problem. I've been reading forums and have come to the
conclusion that the entire application should be using one form and
multiple windowing panels instead of loading a new form every time.
Could this be the problem, or is mine rooted much deeper? I really
would like to figure this out, so any insight would help. If I should
move all the forms into panels, what would be the best way to go about
this as each form is in a separate file.
Thank you for reading.

P.S. This is all done using .Net 2.0 Compact framework with C Sharp.

This is my current code.
Form MediaForm = new frmMediaForm();
MediaForm.Show();
this.Hide();

This what I'm thinking I need to do instead.
pnlMediaForm.Show();
pnlCurrentForm.Hide();

Re: Using window panels instead of windows.forms by ctacke/>

ctacke/>
Fri Jan 18 23:13:44 CST 2008

I disagree. Using lots of Panels inside a single Form will actually require
more memory at one time and is probably not the way to acheive what you're
after.


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com


"personificator" <personificator@gmail.com> wrote in message
news:8b5139ff-a7b2-4ebd-916c-1b8aec14858c@e23g2000prf.googlegroups.com...
> Hello .Net enthusiasts. I have a problem with a Mobil Application I'm
> developing on the Windows CE 5 platform. The application will crash
> eratically without displaying debugging info usually when loading a
> separate form using show and hide methods. I placed try/catches on all
> the code blocks I thought would contribute to the crash, but have not
> solved the problem. I've been reading forums and have come to the
> conclusion that the entire application should be using one form and
> multiple windowing panels instead of loading a new form every time.
> Could this be the problem, or is mine rooted much deeper? I really
> would like to figure this out, so any insight would help. If I should
> move all the forms into panels, what would be the best way to go about
> this as each form is in a separate file.
> Thank you for reading.
>
> P.S. This is all done using .Net 2.0 Compact framework with C Sharp.
>
> This is my current code.
> Form MediaForm = new frmMediaForm();
> MediaForm.Show();
> this.Hide();
>
> This what I'm thinking I need to do instead.
> pnlMediaForm.Show();
> pnlCurrentForm.Hide();



Re: Using window panels instead of windows.forms by Christian

Christian
Sat Jan 19 08:02:50 CST 2008

Ever looked into UserControls? When I make kiosk mode applications, I only
have one main form and everything else are UserControls. You can can always
dispose of them when you don't use them anymore

--
Regards,
Christian Resma Helle
http://christian-helle.blogspot.com


"personificator" <personificator@gmail.com> wrote in message
news:8b5139ff-a7b2-4ebd-916c-1b8aec14858c@e23g2000prf.googlegroups.com...
> Hello .Net enthusiasts. I have a problem with a Mobil Application I'm
> developing on the Windows CE 5 platform. The application will crash
> eratically without displaying debugging info usually when loading a
> separate form using show and hide methods. I placed try/catches on all
> the code blocks I thought would contribute to the crash, but have not
> solved the problem. I've been reading forums and have come to the
> conclusion that the entire application should be using one form and
> multiple windowing panels instead of loading a new form every time.
> Could this be the problem, or is mine rooted much deeper? I really
> would like to figure this out, so any insight would help. If I should
> move all the forms into panels, what would be the best way to go about
> this as each form is in a separate file.
> Thank you for reading.
>
> P.S. This is all done using .Net 2.0 Compact framework with C Sharp.
>
> This is my current code.
> Form MediaForm = new frmMediaForm();
> MediaForm.Show();
> this.Hide();
>
> This what I'm thinking I need to do instead.
> pnlMediaForm.Show();
> pnlCurrentForm.Hide();


Re: Using window panels instead of windows.forms by personificator

personificator
Sat Jan 19 17:51:31 CST 2008

On Jan 19, 9:02 am, "Christian Resma Helle" <xtian...@gmail.com>
wrote:
> Ever looked into UserControls? When I make kiosk mode applications, I only
> have one main form and everything else are UserControls. You can can always
> dispose of them when you don't use them anymore
>
> --
> Regards,
> Christian Resma Hellehttp://christian-helle.blogspot.com
>
> "personificator" <personifica...@gmail.com> wrote in message
>
> news:8b5139ff-a7b2-4ebd-916c-1b8aec14858c@e23g2000prf.googlegroups.com...
>

Are you actually saying to make every panel on all my other forms a
custom user control to be added, shown and hidden to the main form
individually?
That seems like a lot of work, especially when I have a lot of data
being entered and reused later on in the app, but definitely more
memory efficient then my last 2 options.

Re: Using window panels instead of windows.forms by ctacke/>

ctacke/>
Sat Jan 19 22:04:51 CST 2008

Can't see how it's more efficient memory-wise than separate Forms per
screen. When the Form is closed and disposed it's going to release
resources just like a Control would.


--

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


"personificator" <personificator@gmail.com> wrote in message
news:2139a8e1-9e9a-41f1-9762-046ef00b0746@c4g2000hsg.googlegroups.com...
> On Jan 19, 9:02 am, "Christian Resma Helle" <xtian...@gmail.com>
> wrote:
>> Ever looked into UserControls? When I make kiosk mode applications, I
>> only
>> have one main form and everything else are UserControls. You can can
>> always
>> dispose of them when you don't use them anymore
>>
>> --
>> Regards,
>> Christian Resma Hellehttp://christian-helle.blogspot.com
>>
>> "personificator" <personifica...@gmail.com> wrote in message
>>
>> news:8b5139ff-a7b2-4ebd-916c-1b8aec14858c@e23g2000prf.googlegroups.com...
>>
>
> Are you actually saying to make every panel on all my other forms a
> custom user control to be added, shown and hidden to the main form
> individually?
> That seems like a lot of work, especially when I have a lot of data
> being entered and reused later on in the app, but definitely more
> memory efficient then my last 2 options.



Re: Using window panels instead of windows.forms by personificator

personificator
Sun Jan 20 09:06:50 CST 2008

On Jan 19, 11:04 pm, "<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote:
> Can't see how it's more efficient memory-wise than separate Forms per
> screen. When the Form is closed and disposed it's going to release
> resources just like a Control would.
>
> --
>
> Chris Tacke, Embedded MVP
> OpenNETCF Consulting
> Giving back to the embedded communityhttp://community.OpenNETCF.com
>
> "personificator" <personifica...@gmail.com> wrote in message
>
> news:2139a8e1-9e9a-41f1-9762-046ef00b0746@c4g2000hsg.googlegroups.com...

My fear is that there are still controls or data referencing controls
that are used on separate forms that are preventing disposal. I
haven't found any other reason for the app just randomly crashing when
switching between forms. Would it help to put a try catch around
showing and hiding forms? What would be the exception raised? None of
the questions have been answered by the debugger, because it doesn't
happen when debugging!
Thanks for your replies.

Re: Using window panels instead of windows.forms by ctacke/>

ctacke/>
Sun Jan 20 09:42:08 CST 2008

Adding a handler for unhandled appdomain exceptions would be a good start.
Running RPM or the 3.5 profiler might be useful in tracking what objects are
still live as well. If you're having termination due to memory issues,
panels or user controls isn't going to fix it. Resolving the memory issue
is the only way.


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com


"personificator" <personificator@gmail.com> wrote in message
news:d95282e8-4036-40d7-b925-03d0f958fdac@d21g2000prf.googlegroups.com...
> On Jan 19, 11:04 pm, "<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote:
>> Can't see how it's more efficient memory-wise than separate Forms per
>> screen. When the Form is closed and disposed it's going to release
>> resources just like a Control would.
>>
>> --
>>
>> Chris Tacke, Embedded MVP
>> OpenNETCF Consulting
>> Giving back to the embedded communityhttp://community.OpenNETCF.com
>>
>> "personificator" <personifica...@gmail.com> wrote in message
>>
>> news:2139a8e1-9e9a-41f1-9762-046ef00b0746@c4g2000hsg.googlegroups.com...
>
> My fear is that there are still controls or data referencing controls
> that are used on separate forms that are preventing disposal. I
> haven't found any other reason for the app just randomly crashing when
> switching between forms. Would it help to put a try catch around
> showing and hiding forms? What would be the exception raised? None of
> the questions have been answered by the debugger, because it doesn't
> happen when debugging!
> Thanks for your replies.



Re: Using window panels instead of windows.forms by stealthrabbi

stealthrabbi
Mon Jan 21 09:43:43 CST 2008

I have a setup similar to yours... C#, .NET CF 2.0, on Windows CE. I
use multiple forms, and do not experience anything like this. What
details do you have for what is "erratically crashing"?

Re: Using window panels instead of windows.forms by personificator

personificator
Mon Jan 21 19:18:17 CST 2008

On Jan 21, 10:43 am, stealthrabbi <mark.freed...@gmail.com> wrote:
> I have a setup similar to yours... C#, .NET CF 2.0, on Windows CE. I
> use multiple forms, and do not experience anything like this. What
> details do you have for what is "erratically crashing"?

Thats the thing. I don't have info to give you. This doesn't happen
during with debugging on, and I can only get it to happen on the
device. When the crash happens, it is during a form hide show. I know
at least that much, but I have not been able to throw an exception for
this. It only happens 1 time out of 100 or more, so I'm pretty much
flabbergasted at the whole issue.

Re: Using window panels instead of windows.forms by Scott

Scott
Tue Jan 22 13:40:14 CST 2008

personificator <personificator@gmail.com> writes:

[...]

> My fear is that there are still controls or data referencing
> controls that are used on separate forms that are preventing
> disposal. I haven't found any other reason for the app just randomly
> crashing when switching between forms. Would it help to put a try
> catch around showing and hiding forms? What would be the exception
> raised? None of the questions have been answered by the debugger,
> because it doesn't happen when debugging!

I had some problems like this with event handles and an
ObjectDisposedException. A form I created would register an event
handler with a timer object, and when the form was closing
occasionally the timer event would fire, try to run the handler,
reference some part of the form that had already been disposed, and
throw an ObjectDisposedException. I solved this by making sure to
unregister any event handlers when the form is closed. I also caught
and logged an ObjectDisposedException in the application, which helped
me debug it.

Another thing that was helpful in tracking this down was using log4net
to log information about what's going on when my application is
running. Then when I had a crash, I could dig through the log and get
some idea of what was going on when it crashed.

Hope this helps,

----Scott.