This project has moved. For the latest updates, please go here.

Unhandled Exception error when connecting

Topics: User Forum
Nov 17, 2007 at 10:51 PM
Edited Nov 17, 2007 at 10:58 PM
Hi, I've tried at least three versions of Terminals on 4 different computers (3 x Winxp Pro and 1 Win2k3 server) and none will connect, and each attempt results in an "Unhandled Exception error. I have .net versions 1 and 2 installed, and have registered the mstscax.dll . I"ve started with a new configuration and attempted to rdp to several different computers in my home domain, sometimes even with an rdp connection already in progress to the target box.
I"ve tried removing and reinstalling the .net on my main XP machine, but no luck. Any suggestions as to how I might troubleshoot or hopefully fix this problem would be appreciated. I will attempt to attach my config file, as well as my log file, a screen capture of the error message and the output of a .net version checker that I ran.
=================
Log file output:
INFO 2007-11-17 09:06:19,043 1828ms Terminals Main - Terminals 1.6e started
INFO 2007-11-17 09:11:55,695 338480ms Terminals canner_FormClosing -
System.NullReferenceException: Object reference not set to an instance of an object.
at Terminals.Network.Client.Stop() in C:\Source\Terminals\Terminals\Network\Client.cs:line 18
at Terminals.NetworkScanner.NetworkScanner_FormClosing(Object sender, FormClosingEventArgs e) in C:\Source\Terminals\Terminals\NetworkScanner.cs:line 250
WARN 2007-11-17 09:12:09,351 352136ms Terminals Connect - There was an exception setting an RDP Value.
System.ArgumentException: Value does not fall within the expected range.
at MSTSCLib.IMsRdpClientAdvancedSettings.set_overallConnectionTimeout(Int32 poverallConnectionTimeout)
at Terminals.Connections.RDPConnection.Connect() in C:\Source\Terminals\Terminals\Connections\RDPConnection.cs:line 111
FATAL 2007-11-17 09:12:09,383 352167ms Terminals Connect - Connecting to RDP
System.ArgumentException: Value does not fall within the expected range.
at MSTSCLib.IMsRdpClient2.Connect()
at AxMSTSCLib.AxMsRdpClient2.Connect()
at Terminals.Connections.RDPConnection.Connect() in C:\Source\Terminals\Terminals\Connections\RDPConnection.cs:line 210
INFO 2007-11-17 10:33:47,007 187ms Terminals Main - Terminals 1.6e started
=========================

Thanks for any help.,
Joe
Coordinator
Nov 17, 2007 at 11:12 PM
This sounds like a related issue which I believe I have now fixed. If you can, rebuild the current source otherwise it will be included in the next release.
Nov 18, 2007 at 3:04 PM
I tried version 1.6f and got a little further this time. RDP connections gave a "sorry, Terminals can't connect to the remote machine.Try again, or check the log for more information" At least it didn't give the "Unhandled exception error" that I'd been seeing previously. Thanks for working on this problem Rob. I've pasted in my logfile below. Please let me know if you need other info. Regards, Joe.
===========
INFO 2007-11-18 08:45:52,100 171ms Terminals Main - Terminals 1.6e started
WARN 2007-11-18 08:46:17,739 25810ms Terminals Connect - There was an exception setting an RDP Value.
System.ArgumentException: Value does not fall within the expected range.
at MSTSCLib.IMsRdpClientAdvancedSettings.set_overallConnectionTimeout(Int32 poverallConnectionTimeout)
at Terminals.Connections.RDPConnection.Connect() in C:\Source\Terminals\Terminals\Connections\RDPConnection.cs:line 138
FATAL 2007-11-18 08:46:17,786 25857ms Terminals Connect - Connecting to RDP
System.ArgumentException: Value does not fall within the expected range.
at MSTSCLib.IMsRdpClient2.Connect()
at AxMSTSCLib.AxMsRdpClient2.Connect()
at Terminals.Connections.RDPConnection.Connect() in C:\Source\Terminals\Terminals\Connections\RDPConnection.cs:line 241
WARN 2007-11-18 08:46:55,847 63918ms Terminals Connect - There was an exception setting an RDP Value.
System.ArgumentException: Value does not fall within the expected range.
at MSTSCLib.IMsRdpClientAdvancedSettings.set_overallConnectionTimeout(Int32 poverallConnectionTimeout)
at Terminals.Connections.RDPConnection.Connect() in C:\Source\Terminals\Terminals\Connections\RDPConnection.cs:line 138
FATAL 2007-11-18 08:46:55,847 63918ms Terminals Connect - Connecting to RDP
System.ArgumentException: Value does not fall within the expected range.
at MSTSCLib.IMsRdpClient2.Connect()
at AxMSTSCLib.AxMsRdpClient2.Connect()
at Terminals.Connections.RDPConnection.Connect() in C:\Source\Terminals\Terminals\Connections\RDPConnection.cs:line 241
WARN 2007-11-18 08:48:42,674 170744ms Terminals Connect - There was an exception setting an RDP Value.
System.ArgumentException: Value does not fall within the expected range.
at MSTSCLib.IMsRdpClientAdvancedSettings.set_overallConnectionTimeout(Int32 poverallConnectionTimeout)
at Terminals.Connections.RDPConnection.Connect() in C:\Source\Terminals\Terminals\Connections\RDPConnection.cs:line 138
FATAL 2007-11-18 08:48:42,674 170744ms Terminals Connect - Connecting to RDP
System.ArgumentException: Value does not fall within the expected range.
at MSTSCLib.IMsRdpClient2.Connect()
at AxMSTSCLib.AxMsRdpClient2.Connect()
at Terminals.Connections.RDPConnection.Connect() in C:\Source\Terminals\Terminals\Connections\RDPConnection.cs:line 241
WARN 2007-11-18 08:49:58,328 246399ms Terminals Connect - There was an exception setting an RDP Value.
System.ArgumentException: Value does not fall within the expected range.
at MSTSCLib.IMsRdpClientAdvancedSettings.set_overallConnectionTimeout(Int32 poverallConnectionTimeout)
at Terminals.Connections.RDPConnection.Connect() in C:\Source\Terminals\Terminals\Connections\RDPConnection.cs:line 138
FATAL 2007-11-18 08:49:58,328 246399ms Terminals Connect - Connecting to RDP
System.ArgumentException: Value does not fall within the expected range.
at MSTSCLib.IMsRdpClient2.Connect()
at AxMSTSCLib.AxMsRdpClient2.Connect()
at Terminals.Connections.RDPConnection.Connect() in C:\Source\Terminals\Terminals\Connections\RDPConnection.cs:line 241
WARN 2007-11-18 08:57:55,556 723626ms Terminals Connect - There was an exception setting an RDP Value.
System.ArgumentException: Value does not fall within the expected range.
at MSTSCLib.IMsRdpClientAdvancedSettings.set_overallConnectionTimeout(Int32 poverallConnectionTimeout)
at Terminals.Connections.RDPConnection.Connect() in C:\Source\Terminals\Terminals\Connections\RDPConnection.cs:line 138
FATAL 2007-11-18 08:57:55,556 723626ms Terminals Connect - Connecting to RDP
System.ArgumentException: Value does not fall within the expected range.
at MSTSCLib.IMsRdpClient2.Connect()
at AxMSTSCLib.AxMsRdpClient2.Connect()
at Terminals.Connections.RDPConnection.Connect() in C:\Source\Terminals\Terminals\Connections\RDPConnection.cs:line 241
Coordinator
Nov 18, 2007 at 9:53 PM
This is really the portion to focus on. It appears that it is attempting to actually connect, regardless of your settings and then throwing the exception.

FATAL 2007-11-17 09:12:09,383 352167ms Terminals Connect - Connecting to RDP
System.ArgumentException: Value does not fall within the expected range.
at MSTSCLib.IMsRdpClient2.Connect()
at AxMSTSCLib.AxMsRdpClient2.Connect()
at Terminals.Connections.RDPConnection.Connect() in C:\Source\Terminals\Terminals\Connections\RDPConnection.cs:line 210


Obviously there is no clue as to which Value it is referring to. Good ole COM interop! I'm pretty sure it wont matter, but any chance your running on a 64bit OS? I'm at a loss here!

You can connect with mstsc.exe to the same machine, correct?
Nov 18, 2007 at 11:54 PM
Rob, no, I"m running WinXP Pro on the 3 machines that I tried it on. Yes, I do remote desktop connections and VNC on my boxes several times a day. I work remotely from home and work all day via RDP and ICA through a VPN connection to my employer, although I haven't tried that environment yet.

I've tried setting up the connection both with, and without credentials pre-configured, and that makes no difference. The connection fails immediately. There is no 'time out' or pause. the terminal screen says "Connecting, Please Wait" and immediately the error box pops up saying "Sorry, Terminals was unable to connect to the remote machine."

If I try to connect using VNC I get a RED X across and around the Terminal window, and an error message about an Unhandled Exception.

What other information can I give you to help in this endeavor?
Regards,
Joe
Nov 19, 2007 at 2:52 PM
I am seeing the same effects no as well.

I was getting an ArgumentOutofRange exception over the weekend but you put up some new changesets rob which seemed to fix that problem. Now I am having the same issue as jps. Here is a snippet from the log file:

FATAL 2007-11-19 10:46:57,730 138986ms Terminals Connect - Connecting to RDP
System.ArgumentException: Value does not fall within the expected range.
at MSTSCLib.IMsRdpClient2.Connect()
at AxMSTSCLib.AxMsRdpClient2.Connect()
at Terminals.Connections.RDPConnection.Connect() in C:\Source\Terminals\Terminals\Connections\RDPConnection.cs:line 241

Line 241 is:

axMsRdpClient2.Connect();

It's strange because a co-worker that is not a developer is able to use terminals with no problems at all, While I am receiving this error message.

Let me know if there is anything I can do to help. I will try to debug it if i have time, although I am not familiar with codeplex so I'm not sure how to send you a patch like I would if i were using subversion.
Coordinator
Nov 19, 2007 at 5:53 PM

I wonder if it is because of some service pack or something which upgraded the MSRdpClient control..or maybe your machine has NOT been updated?

If you want to patch, you might be able to see "Upload Patch" at the top of:
http://www.codeplex.com/Terminals/SourceControl/ListDownloadableCommits.aspx

Nov 29, 2007 at 2:08 PM
I am having the exact same problem.

Here's my error log, I think its the same as above:

WARN 2007-11-29 09:57:12,156 104046ms Terminals Connect - There was an exception setting an RDP Value.
System.ArgumentException: Value does not fall within the expected range.
at MSTSCLib.IMsRdpClientAdvancedSettings.set_overallConnectionTimeout(Int32 poverallConnectionTimeout)
at Terminals.Connections.RDPConnection.Connect() in C:\Source\Terminals\Terminals\Connections\RDPConnection.cs:line 138
FATAL 2007-11-29 09:57:12,156 104046ms Terminals Connect - Connecting to RDP
System.ArgumentException: Value does not fall within the expected range.
at MSTSCLib.IMsRdpClient2.Connect()
at AxMSTSCLib.AxMsRdpClient2.Connect()
at Terminals.Connections.RDPConnection.Connect() in C:\Source\Terminals\Terminals\Connections\RDPConnection.cs:line 241

I'm really excited to start taming all my RDP windows, so I hope this can be fixed soon! Thanks for all of your hard work.
Jan 15, 2008 at 9:52 PM
I have this same problem, and I do have RDP 6.0 installed. The log also states I started 1.6e, although this is 1.6f... Any clue?

INFO 2008-01-15 16:00:30,892 250ms Terminals Main - Terminals 1.6e started
WARN 2008-01-15 16:00:44,283 13640ms Terminals Connect - There was an exception setting an RDP Value.
System.ArgumentException: Value does not fall within the expected range.
at MSTSCLib.IMsRdpClientAdvancedSettings.set_overallConnectionTimeout(Int32 poverallConnectionTimeout)
at Terminals.Connections.RDPConnection.Connect() in C:\Source\Terminals\Terminals\Connections\RDPConnection.cs:line 138
FATAL 2008-01-15 16:00:44,523 13881ms Terminals Connect - Connecting to RDP
System.ArgumentException: Value does not fall within the expected range.
at MSTSCLib.IMsRdpClient2.Connect()
at AxMSTSCLib.AxMsRdpClient2.Connect()
at Terminals.Connections.RDPConnection.Connect() in C:\Source\Terminals\Terminals\Connections\RDPConnection.cs:line 241
Dec 20, 2009 at 8:50 PM

I think I have a similar problem:

After having migrated (from XP, SP3) to Windows 7, Terminals (1.8b) very often throws the following message when trying to start a new session:

Sorry, Terminals was unable to connect the remote machine. Try again, or check the log for more information.

Already running sessions continues to work though, but the only way to resolve is to restart Terminals.

I've noticed that it often (but not only) appears when changing the "network scope" i.e. logging in to and out of my VPN.

I've tried various compatibility settings with out luck.  I've only noticed it for RDP, which is the type of connection I mainly use.

The log shows the following:

INFO  2009-12-20 22:38:22,893 882055ms Terminals              SaveHistory        - Saving History
INFO  2009-12-20 22:38:22,913 882075ms Terminals              SaveHistory        - Done Saving History
INFO  2009-12-20 22:38:22,914 882076ms Terminals              SaveHistory        - Save History Duration:21ms
INFO  2009-12-20 22:38:22,915 882077ms Terminals              LoadHistory        - Loading History:History.xml
INFO  2009-12-20 22:38:22,915 882077ms Terminals              LoadHistory        - Done Loading History
INFO  2009-12-20 22:38:22,915 882077ms Terminals              LoadHistory        - Load History Duration:0ms
ERROR 2009-12-20 22:38:22,921 882083ms Terminals              ChangeDesktopSize  - Error trying to set the desktop dimensions
Property set of 'DesktopWidth' cannot be invoked at this time.
WARN  2009-12-20 22:38:22,922 882084ms Terminals              Connect            - There was an exception setting an RDP Value.
Property set of 'ColorDepth' cannot be invoked at this time.
FATAL 2009-12-20 22:38:22,923 882085ms Terminals              Connect            - Connecting to RDP
Method 'Connect' cannot be invoked at this time.
INFO  2009-12-20 22:38:24,567 883729ms Terminals              CreateTerminalTab  -
Property get of 'FullScreen' cannot be invoked at this time.
FATAL 2009-12-20 22:38:24,568 883730ms Terminals              on_ThreadException - Application Exception
Property get of 'FullScreen' cannot be invoked at this time.
INFO  2009-12-20 22:39:03,502 922664ms Terminals              WndProc            -
Property set of 'FullScreen' cannot be invoked at this time.

Jun 2, 2012 at 9:39 AM
Edited Jun 2, 2012 at 10:18 AM

Hello everyone on this site,

Actually I am using Microsoft Terminal Services Component  in my VB.Net Project for RDC. Its connecting well on windows XP and even Windows 7 x86 operating system but its giving me error when I am using the same thing on Windows 7 64 Bit OS. Error Message is :

Could not load file or assembly 'Interop.MSTSCLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.

So if anyone could help me in solving this problem, really it would be appreciable.....

Thanks in advance!!!!!!