Rick45 / cassia

Automatically exported from code.google.com/p/cassia
0 stars 0 forks source link

A close operation is pending on the session #60

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Enumerate current terminal sessions

What is the expected result? What happens instead?

Return current terminal sessions, instead returns an exception.

What version of Cassia are you using (e.g. 2.0.0.60)?

2.1.0.119

On what Windows version is your code running?

Microsoft Windows Server 2003 x64 & x84

Is your code running as a Windows service, an ASP.NET application, or a
standalone application?

Windows service

What Windows version is running on the remote server you are trying to
access (if any)?

n/a

Please provide any additional information below. If you are running into an
exception, please include a stack trace (at least the portion of it that
relates to Cassia).

System.ComponentModel.Win32Exception (0x80004005): A close operation is pending 
on the session
   at Cassia.Impl.NativeMethodsHelper.GetWinStationInformation(ITerminalServerHandle server, Int32 sessionId)
   at Cassia.Impl.TerminalServicesSession.LoadWinStationInformationProperties()
   at Cassia.Impl.GroupLazyLoadedProperty`1.get_Value()
   at Cassia.Impl.TerminalServicesSession.get_UserAccount()

Original issue reported on code.google.com by DanielBL...@gmail.com on 1 Jun 2012 at 2:11

GoogleCodeExporter commented 9 years ago
This exception is thrown when the underlying Windows API returns an error code 
indicating that the session is being closed. You'll typically see this when 
trying to retrieve information about a session that is in the process of being 
logged off (especially if your service is reacting to session log off events!). 
The solution is to catch the exception in your code and discard the session 
object.

Original comment by danports on 1 Jun 2012 at 2:31