Login  
Search All Forums
Dart Home | PowerTCP Emulation for .NET | Custom Development Reply | PowerTCP Emulation for .NET Topics | Forums   
AuthorForum: PowerTCP Emulation for .NET
Topic: InvalidOperationException
hkyfsh

From: Flagstaff, AZ USA
Posts: 2
Member Since: 02/17/12
posted February 17, 2012 7:45 PM

I have an application that calls a modified version of the Telnet Client 3.5 sample that is provided. It is accessed via a context menu option. The first time it is clicked the emulator opens and works fine and I connect. If I close the emulator (via the red X) and go into a different part of the application, then open the emulator again, after 5-10 seconds it throws an unhandled exception which is InvalidOperationException was unhandled.

Invoke or BeginInvoke cannot be called on a control until the window handle has been created.

It does not show the code that this occurred on but if you click on View Detail the name is MarshaledInvoke so thinking that this is being called on another thread from within the frmConnect. Any ideas?
Jamie Powell (Admin)

From: Rome, NY USA
Posts: 448
Member Since: 03/13/07

Extra Support Options
Custom Application Development

posted February 20, 2012 4:57 PM

You may want to examine the stackoverflow post here:
http://stackoverflow.com/questions/808867/invoke-or-begininvoke-cannot-be-called-on-a-control-until-the-window-handle-has

Or look into whether your application is trying to access the form you already closed.

It's difficult for us to say what might help without examining your code; if you're interested, please contact sales@dart.com for more information.

------
-Non-current subscribers must contact sales@dart.com to update subscription and receive continued support as needed.
------

hkyfsh

From: Flagstaff, AZ USA
Posts: 2
Member Since: 02/17/12
posted February 21, 2012 2:11 PM

OK I was able to determine what was going on by opening the debug window. When the user would close the emulator with the red X in the upper right hand corner without properly exiting the telnet session, the session would remain active and when it tried to return data, the window was already disposed. I added telnetModel.Telnet.Close() to the form_closing event and that did the trick.
Reply | PowerTCP Emulation for .NET Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX