Exception while zooming the View

While zooming in and out inside an instance of a GoView
derivate by pressing the Control key and turning the
mousewheel very rarely we get an exception like the
following.
It is hard to reproduce. What could be the reason?

It seems to be an access to a GoView instance from a
timer event.

We are instantiating several GoView derivations
called FunctionBlockEditorView in our graphical
editor implemented with the Northwoods Go library
one after another. That means the user sees only one
instance at the same time. When switching to another
View the complete FunctionBlockEditorView is newly
instantiated and the old instance is diposed each time.

Could be the reason that an internal delegate method is
not accessing the right FunctionBlockEditorView instance?
Or a timer controlled delegate of an old FunctionBlockEditorView
instance is still active after disposing the view?

Tobias.

13.01.2009 10:38:43 - called from [CurrentDomain.UnhandledException]

Type of Exception:
System.ObjectDisposedException


Message:
HRESULT = 0x80131622
LastWin32Error = 0x0

Auf das verworfene Objekt kann nicht zugegriffen werden. (Dismissed object cannot be accessed.)
Objektname: FunctionBlockEditorView.


Source:
System.Windows.Forms


Methode:

System.Object MarshaledInvoke(System.Windows.Forms.Control, System.Delegate, System.Object[], Boolean)


StackTrace (from exception):

bei System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
bei System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
bei System.Windows.Forms.Control.Invoke(Delegate method)
bei Northwoods.Go.GoView.hoverCallback(Object obj)
bei System.Threading._TimerCallback.TimerCallback_Context(Object state)
bei System.Threading.ExecutionContext.runTryCode(Object userData)
bei System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading._TimerCallback.PerformTimerCallback(Object state)


StackTrace (from System.Environment.StackTrace):

bei System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
bei System.Environment.get_StackTrace()
bei AutomationSuite.Application.Start.GetDetailExceptionInfo(Exception e, String caller)
bei AutomationSuite.Application.Start.CurrentDomain_UnhandledException(Object sender, UnhandledExceptionEventArgs e)
bei System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
bei System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
bei System.Windows.Forms.Control.Invoke(Delegate method)
bei Northwoods.Go.GoView.hoverCallback(Object obj)
bei System.Threading._TimerCallback.TimerCallback_Context(Object state)
bei System.Threading.ExecutionContext.runTryCode(Object userData)
bei System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading._TimerCallback.PerformTimerCallback(Object state)

The exception is when the HoverTimer fires. But we call Dispose on the timer when GoView.Dispose is called, so I don’t see how you’re getting into trouble here.

Are you replacing GoViews while you are zooming? I don't understand why zooming would have anything to do with a hover timer.
Are you using threads?

I call the GoView.Dispose method everytime I drop an editor instance. GoViews are not replaced while zooming and I don’t use threads.

What is the timer good for? Is it possible to deactivate it?

That timer is used to detect mouse hover.

If you really don’t want hover events, I suppose you could override GoView.DetectHover to be a no-op.

But I’m wondering what’s different about your application such that you see this occasional exception. Our code does account for the explicit GoView.Dispose along with a possibly later arrival of the timer callback. Perhaps there’s some combination and/or order that we hadn’t anticipated.