Hi,
I am setting System.Threading.Thread.CurrentPrincipal to a Windows
pricipal before I go ahead call methods to process, sometimes cross
assembly.
The problem I am facing is that intermittently the WindowsPrincipal
object within seems to be garbage collected because I get "Handle is
invalid" sometimes.I tried setting GC.KeepAlive
(System.Threading.Thread.CurrentPrincipal) post setting the value in
CurrentPrincipal variable. It did not help the cause.
Is there something amiss in what I am doing here?
Thanks in advance,
Madhu
Willy Denoyette [MVP] - 11 Aug 2005 12:37 GMT
What do you mean with "sometimes cross assembly"? you aren't talking about
cross-domain ain't you?
What's the calling function that throws the "Handle is invalid" error? How
does the call stack looks like?
Don't forget that principals don't flow across threads!
Mind to post a simple sample that illustrates the issue?
Willy.
> Hi,
> I am setting System.Threading.Thread.CurrentPrincipal to a Windows
[quoted text clipped - 11 lines]
> Thanks in advance,
> Madhu
hB - 15 Aug 2005 11:54 GMT
I think sample code would be helpful to illustrate the actual issue.
Just a guess (from the assumption of your scenario):
Declare your 'WindowsPrincipal' object to be public static (Shared in
Visual Basic)
---
hB