Small world :)

As far as I can tell, I'm seeing exactly the same issue.  In my case, it
only seems to appear when I'm using background threads.  If, for
example, I put the login code directly on a button click event handler,
it works fine.  The problem is that I really do not want to hang up the
UI while the login takes place.  The timer hack was an attempt to
completely "decouple" the execution of the code that sets the
Thread.CurrentPrincipal from the background thread, which one way or
another seems to be cursed (for lack of a better word).  The strange
thing for me is that setting it on the BackgroundWorker.Completed event
(which AFAIK fires on the calling thread, in this case the UI thread)
should have worked...  Surely there should be some mention of this on
MSDN, yet I see nothing?

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Peter Ritchie
Sent: 24 July 2007 01:24 PM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: Re: [ADVANCED-DOTNET] Strange issue with
Thread.CurrentPrincipal and BackgroundWorker / Threads

I was involved with that particular thread.  What I had found was that
setting the thread's principle was simply ignored when processing a
winform
event, at least the several I tried.  Or, at least appears to be
ignored.
I figured something was restoring the state of the thread after each
event
handler is called to avoid it being corrupt for other events...

So, I'm surprised that you could get it to work with a Timer Elapsed
event.

I'll have a closer look at it later today to see if I can see why it
would
be different...

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

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

===================================
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