469,904 Members | 2,252 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,904 developers. It's quick & easy.

Hang in Dispose with ActiveX control

Banging my head against the wall trying to figure this out. I have a
'sometimes' hang while disposing a form which contains an ActiveX
control (Flash.ocx version 7). The form's Dispose() method generated by
the form designer

protected override void Dispose( bool disposing )
if( disposing )
if(components != null)
base.Dispose( disposing );

However, it never puts anything in 'components'. Anyway, the hang is
inside the base.Dispose
mscorlib.dll!System.GC.GetTotalMemory(bool forceFullCollection = true) + 0x23 bytes

system.windows.forms.dll!System.Windows.Forms.Appl ication.CollectAllGarbage()
+ 0xd bytes

system.windows.forms.dll!System.Windows.Forms.AxHo st.ReleaseAxControl()
+ 0x2a6 bytes

system.windows.forms.dll!System.Windows.Forms.AxHo st.TransitionDownTo(int
state = 0) + 0x151 bytes

system.windows.forms.dll!System.Windows.Forms.AxHo st.DisposeAxControls()
+ 0x30 bytes

system.windows.forms.dll!System.Windows.Forms.Cont rol.DisposeAxControls()
+ 0x54 bytes
system.windows.forms.dll!System.Windows.Forms.Cont rol.Dispose(bool
disposing = true) + 0x1ce bytes

system.windows.forms.dll!System.Windows.Forms.Cont ainerControl.Dispose(bool
disposing = true) + 0x2b bytes
system.windows.forms.dll!System.Windows.Forms.Form .Dispose(bool
disposing = true) + 0x2b0 bytes
TestDisposeAx.exe!TestDisposeAx.Form2.Dispose(bool disposing = true)
Line 48 C#
The stack trace leaves me with several questions.
1. GetTotalMemory(true). One reference says this will call garbage
collection repeatedly until memory usage stabilizes within 5% - which
sounds like it blocks some indefinite period of time. Other references
say this just means it might wait 'a short time'.
2. Why would ReleaseAxControl call CollectAllGarbage??
3. Why, after I try Controls.Remove(player), does that base.Dispose()
still wind up down in ReleaseAxControl?
4. And of course, what could be blocking that GetTotalMemory? All other
threads which I can see are merely waiting for an event. The form and
the player were created on that main thread, the same one making the
dispose call. I'm not aware that we've coded any of our own finalizers

It doesn't always hang. I do have a repeatable way to get my whole app
to hang, and a repeatable way where it doesn't hang, but at the point
of the call to dispose they aren't any different! My only guess as to
why that would happen is that one way churns more memory than the
other, maybe forces more garbage collections or something.

For reference, we are stuck back on 1.1 and I have little hope of being
able to change that any time soon.

Any suggestions?

May 4 '06 #1
0 2950

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by wang xiaoyu | last post: by
2 posts views Thread by Fie Fie Niles | last post: by
3 posts views Thread by Jeffery Franzen | last post: by
7 posts views Thread by Peter Proost | last post: by
3 posts views Thread by Weston Fryatt | last post: by
7 posts views Thread by Jarod_24 | last post: by
2 posts views Thread by Wilfried Mestdagh | last post: by
6 posts views Thread by hufaunder | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.