Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

GC problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Madhu Gopinathan - 11 Aug 2005 07:50 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.