Problem after Disposing a ShowDialog() Form

D

Duncan Mole

Hi,

Can someone clarify the position on memory usage after a form has been shown
modally. I have read that in order to reclaim memory I must call Dispose()
after assigning a DialogResult to it (as it is simply hidden) but surely if
there are no outstanding references to it in my code it will be subject to
the normal laws of GC and scoping?

I ask because I have implemented dispose after assigning a DialogResult and
it causes some strange behavoir, specifically, the ActiveSync window is
brought in front of my application.

Thanks
 
A

Alex Feinman [MVP]

Are you disposing of the form from its own code??
Typically what you do is:

MyForm form = new MyForm();
DialogResult result = form.ShowDIalog();
form.Dispose();

AFAIK there was some work done in SP2 to let GC reclaim a form after it has
no outstanding references, but in preSP2 CF there was a problem. Every
control created was automatically added to a statig ArrayList inside Control
class inaccessible from outside. This created an outstanding reference that
would keep the form alive forever,
 
D

Duncan Mole

Ah thanks Alex. I had been doing that actually and no problems once I moved
that bit of code.

On the subject of SP2, is it possible to install the cab via a .NET
application calling into wceload? I wanted to add it to my existing
installer application but got errors about the .nlp files being in use.
Should I go ahead and port the entire installer to eVC?
 
A

Alex Feinman [MVP]

You should be able to install a cab via a call to wceload, but of course if
you try to install a Compact Framework service pack from a Compact Framework
application, it will fail because some files are in use
 
D

Duncan Mole

Thas what I thought.

Cheers for clearing it up.

Alex Feinman said:
You should be able to install a cab via a call to wceload, but of course if
you try to install a Compact Framework service pack from a Compact Framework
application, it will fail because some files are in use
 

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