According to MSDN:

Control.Disposing Property Gets a value indicating whether the base Control class is in the process of disposing.

But when I checked, Disposing property of the control is always false (inside the Dispose() method itself).

When will this Disposing property become true?

4 Years
Discussion Span
Last Post by NidhiSree

Just because your parent is disposing, doesn't mean your child control is currently disposing. It could happen later, it could have already happened. In most cases a Dispose runs that quickly that you will never pick up the "true" flag.

The other possibility is that you have a memory leak and the control is never disposed of. The Garbage Collector might come and get it at some point, but best to be sure.


Yes. I got it.
It will be true in the disposing event of base control. I have checked the MSDN implementation. In Dispose() method of Control class, the property is set as true in disposing code block and it is reset to false after disposed.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.