dbremner / cassia

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

Better exception message when trying to access a property of a session that no longer exists #59

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Unable to reproduce, but occurs now and then.

What is the expected result? What happens instead?
Expect to retrieve the list of sessions. Instead it throws an error

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

On what Windows version is your code running?
Windows Server 2008 Standard

Is your code running as a Windows service, an ASP.NET application, or a
standalone application?
Running as a Windows Service with SYSTEM account

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

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).
Stacktrace unavailable.

Original issue reported on code.google.com by whypurpl...@gmail.com on 13 Apr 2012 at 7:52

GoogleCodeExporter commented 8 years ago
Stack trace: 
System.ComponentModel.Win32Exception: The system cannot find the file specified
   at Cassia.Impl.NativeMethodsHelper.QuerySessionInformation[T](ITerminalServerHandle server, Int32 sessionId, WTS_INFO_CLASS infoClass, ProcessSessionCallback`1 callback)
   at Cassia.Impl.TerminalServicesSession.GetClientIPAddress()
   at Cassia.Impl.LazyLoadedProperty`1.get_Value()
   at Cassia.Impl.TerminalServicesSession.get_ClientIPAddress()
   at windowservice.LogoffHandler.ProcessPostLogoffEvents(Object state)

Original comment by whypurpl...@gmail.com on 13 Apr 2012 at 8:30

GoogleCodeExporter commented 8 years ago
You'll most often see this exception when you're attempting to access a 
property of a session that no longer exists. Given that you're running some 
logic on session logoff (based on your stack trace), this result is not 
uncommon. The solution would be for you to catch the Win32Exception that is 
thrown and handle it appropriately.

It would be better if the library threw an exception with a more specific error 
message though.

Original comment by danports on 13 Apr 2012 at 1:24

GoogleCodeExporter commented 8 years ago
Issue 68 has been merged into this issue.

Original comment by danports on 6 Jun 2013 at 12:39