[Mono-dev] Bug in Dispatcher.cs VerifyAccess or am I confused on the mono threading model?
brad at bradcunningham.net
Mon Apr 4 20:54:24 EDT 2011
I just upgraded to 2.10 and am getting strange behavior that I wasn't seeing
I call VerifyAccess in my code which is the method in the Dispatcher class
that will compare the calling thread with the thread that the dispatcher was
created on, if they differ it will throw an exception. In 2.8.1 it seemed
that the Dispatcher object was always null so I never called these methods.
In 2.10 it seems the Dispatcher is no longer null so I am making it into my
calls to VerifyAccess and it is throwing an exception:
System.InvalidOperationException: "The calling thread is not the same as the
a few things that are strange about this:
Prior to calling verify access I am doing some sanity checks
1. Dispatcher is not null
2. It's hash code matches the Thread.CurrentThreads hash code
3. Dispatcher.Thread == Thread.CurrentThread evaluates true
4. Looking at the code from the 2.10 branch for dispatcher this doesn't
appear to be the error text that should be thrown so I assume something else
is going on here.
That seems to tell me that they are in fact the same thread and the
exception should NOT be thrown. Since the error message doesn't seem correct
I assume something else is going on here that I don't understand.
Microsoft MVP: C#
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-devel-list