http://msdn2.microsoft.com/en-us/library/system.threading.executioncontext.aspx

mentions:

... Within an application domain, the entire execution context must be
transferred whenever a thread is transferred. This situation occurs
during ... Windows Forms thread marshaling through the Windows message
pump. ...


An other solution might be, create a custom principal which delegates
its calls to an inner principal, say ProxyPrincipal with a property
RealPrincipal.

Before executing BWG set the current principal to an instance of
ProxyPrincipal and assign RealPrincipal to the
Thread.CurrentPrincipal.

Now in the Completed event of the BWG set the RealPrincipal to your
newly begotton MyPrincipal instead of the Thread.CurrentPrincipal.

I believe now we have tricked the ExectionContext undo, since the
reference to ProxyPrincipal has not been changed.

HTH
// Ryan

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to