Terminals 1.6G + VNC

Topics: Developer Forum
Apr 11, 2008 at 8:46 AM
Hi,
I tried to connect to a VNC server (version 4.0) and after have entered my password, Terminals crashs and give me the following error:
"RemoteDesktop is unknown State: Disconnecting."
I'm not able to have more information on the exception, because my Vista asks me to "search solution on web or close the program".

Is it possible to have more trace for Terminals?
Is there a minimal version for vnc server?

Regards
Renald
Apr 11, 2008 at 2:59 PM
I have new information. I replicate the problem on my windows XP.
If you it can help you to understand the problem, here is the error description:


                            • Exception Text **************
System.NotImplementedException: RemoteDesktop in unknown State: Disconnecting.
at VncSharp.RemoteDesktop.OnPaint(PaintEventArgs pe)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


                            • Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Terminals
Assembly Version: 1.6.0.0
Win32 Version: 1.6.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Developper/Desktop/Terminals/Terminals.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GACMSIL/System.Windows.Forms/2.0.0.0_b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GACMSIL/System/2.0.0.0_b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GACMSIL/System.Drawing/2.0.0.0_b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
log4net
Assembly Version: 1.2.10.0
Win32 Version: 1.2.10.0
CodeBase: file:///C:/Documents%20and%20Settings/Developper/Desktop/Terminals/log4net.DLL
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GACMSIL/System.Configuration/2.0.0.0_b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GACMSIL/System.Xml/2.0.0.0_b77a5c561934e089/System.Xml.dll
----------------------------------------
TabControl
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Developper/Desktop/Terminals/TabControl.DLL
----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC32/System.Data/2.0.0.0_b77a5c561934e089/System.Data.dll
----------------------------------------
ICSharpCode.SharpZipLib
Assembly Version: 0.85.4.369
Win32 Version: 0.85.4.369
CodeBase: file:///C:/Documents%20and%20Settings/Developper/Desktop/Terminals/ICSharpCode.SharpZipLib.DLL
----------------------------------------
VncSharp
Assembly Version: 0.9.0.0
Win32 Version: 0.9.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Developper/Desktop/Terminals/VncSharp.DLL
----------------------------------------
AxInterop.MSTSCLib
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Developper/Desktop/Terminals/AxInterop.MSTSCLib.DLL
----------------------------------------
el88u49w
Assembly Version: 1.6.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GACMSIL/System/2.0.0.0_b77a5c561934e089/System.dll
----------------------------------------
TransPort2006
Assembly Version: 3.0.1.7
Win32 Version: 3.0.1.7
CodeBase: file:///C:/Documents%20and%20Settings/Developper/Desktop/Terminals/TransPort2006.DLL
----------------------------------------
Coordinator
Apr 20, 2008 at 5:56 PM
i just commited a quick update which i hope will fix this issue. its difficult to determine exactly where the issue exists. From what I can tell its probably within the VNC DLL itself and not in terminals, which even adds more frusteration. So for this fix i just made sure that all of the code in the VNC connection has a try/catch around it, and if an exception is thrown it will get tossed into the log.

give it a try in the next release and try to follow up.

thanks.
Apr 21, 2008 at 7:39 AM
Hi,
I will problaby build a version with the last svn source code.
In which file did you done the update?

Renald
Apr 21, 2008 at 7:58 AM
Hi,

I get the source code and obtain the following error:

System.InvalidOperationException was unhandled
Message="RemoteDesktop must be in Connected state before calling methods that require an established connection."
Source="System.Windows.Forms"
StackTrace:
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
at VncSharp.VncClient.OnConnectionLost()
at VncSharp.VncClient.GetRfbUpdates()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

I will analyze the problem and give you feebacks.

Renald
Coordinator
Apr 30, 2008 at 7:02 AM
can you determine which file/line is throwing this exception. essentially all i want to do is try/catch the exception and throw up a more appropriate dialog letting the user know that there was an issue. i have that around all of the code in the vncconnection but it appears it might be in some other form.

thanks.
Apr 30, 2008 at 8:11 AM
OK, it is a little complex, but I'll try to explain the problem.
When I tried to connect to my VNC server (version 4.0 so old version), Terminals connects to my VNC server and receives in the same a ConnectionLost event.

In Terminals, File: Connections\VNCConnection.cs,
After the function rd_Connectcomplete, I get the exception. In fact, the exception is not raised by Terminals, but by VNCSharp dll.
It is not possible to you to add try/catch block to avoid exception.

To correct this exception, you must go to VNCSharp, File RemoteDesktop.cs, Function: InsureConnection.
If you look at the code if the variable "conected" is set to true, there is an Assert on state (must be Connected or Disconnecting)
In my case, I'm in state Disconnecting.
But after the Assert, a "If" is done but it test only the Connected state and not the Disconnecting state. So it raise an exception.
So I correct the bug and now I don't have anymore the exception.

But do you recompile VNCSharp dll?

But after doing that, in Terminals, you must register the ConnectionLost event on the RemoteDesktop object in the Connect function of VNCConnection class and put this code in the event function:
void rd_ConnectionLost(object sender, EventArgs e)
{
connected = false;
Terminals.Logging.Log.Info("VNC ConnectionLost");
}
This code tell Terminals that the current remote desktop is not connected. If I don't do that, when you will close the tab for this connection, you will have a beautiful exception because Terminals thinks you're connected.

Regards
Renald


RobChartier wrote:
can you determine which file/line is throwing this exception. essentially all i want to do is try/catch the exception and throw up a more appropriate dialog letting the user know that there was an issue. i have that around all of the code in the vncconnection but it appears it might be in some other form.

thanks.

Coordinator
Apr 30, 2008 at 10:18 PM
Renald.

thanks for the great insight. Im in the process of moving VncSharp fully into the build process and I will make the change as stated above.

thanks again.

-Rob
Coordinator
Apr 30, 2008 at 10:36 PM
done.
Jun 26, 2008 at 9:58 AM
Hi Renald,

I am using VNCSharp 0.9.0. I made the changes in RemoteDesktop.cs and it worked for me. But I did not put the following code you mentioned
Terminals.Logging.Log.Info("VNC ConnectionLost");

Did you mean by System.Diagnostics.Debug.Assert ?

Can you please elaborate more on this?
I checked the VNCSharp code, but nowhere they are logging using Terminals.Logging.Log.Info.
Jun 26, 2008 at 11:53 AM
Hi,

This code - Terminals.Logging.Log.Info - is located in Terminals source code, and not in VNCSharp.

I mean that the assert return an error, so the code return error but it was not treats in Terminals.

Renald
Jun 26, 2008 at 2:23 PM


Renald wrote:
Hi,

This code - Terminals.Logging.Log.Info - is located in Terminals source code, and not in VNCSharp.

I mean that the assert return an error, so the code return error but it was not treats in Terminals.

Renald


So I do not need to think about Terminals.Logging.Log.Info ?