RasDialer.DialAsync crash Winform when called by Send Message

May 10, 2010 at 11:28 AM
Edited May 10, 2010 at 11:29 AM

Hi,

First of all, Thanks for this wonderful invention! It is a great help!

I have a WinForm app that has two forms, One form is a scheduler and Second form is command Executioner. The [scheduler form] checks the time if needed to do the connection. When it is triggered it will use SendMessage to send a command to the second form to do the connecting process but when it is about to call the DialAsync function, the application just close.

 

here is the exception message

===Message===
This connection is already being dialed.
===Stack Trace===
   at DotRas.ThrowHelper.ThrowRasException(Int32 errorCode)
   at DotRas.RasHelper.Dial(String phoneBook, RASDIALPARAMS parameters, RASDIALEXTENSIONS extensions, RasDialFunc2 callback, RasEapOptions eapOptions)
   at DotRas.RasDialer.InternalDial(NetworkCredential credentials, Boolean asynchronous)
   at DotRas.RasDialer.DialAsync(NetworkCredential credentials)
   at DotRas.RasDialer.DialAsync()
   at CasualGameConsole.Network.WkBroadband.Connect() in D:\CasualGameConsole_CG.1.8.0.11\CasualGameConsole\Network\WkBroadband.cs:line 96
   at CasualGameConsole.WkConsolePlatformForm.StartConnection() in D:\CasualGameConsole_CG.1.8.0.11\CasualGameConsole\WkConsolePlatformForm.cs:line 7206
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

 

Any idea on this?

Thanks in advance!

 

-Dantz

Coordinator
May 10, 2010 at 2:26 PM

The error tells you exactly why the application is crashing... "The connection is already being dialed."

May 10, 2010 at 2:52 PM

Thanks for the reply. I cannot understand why it was being dialed, because there were no other program accessing the device.

Anyway, I just unplugged and plugged the device and it worked after I done that for three times.

 

Coordinator
May 10, 2010 at 3:10 PM

If you didn't read the SDK documentation (which I'm guessing you probably didn't) the RasDialer component documentation states "Failure to dispose of this component may result in a connection attempt hanging, which will require the machine to be restarted before the connection is released." If your application crashes for any reason and you don't properly dispose of the object before your app terminates, you will have to reboot to fix it. It's probably what you were experiencing with your device, especially if you were using DialAsync to perform the call.

This isn't something I can fix in the project either. This particular problem is an issue with Windows and working with applications that can terminate.

Jun 8, 2010 at 3:33 AM
jeff_winn wrote:

If you didn't read the SDK documentation (which I'm guessing you probably didn't) the RasDialer component documentation states "Failure to dispose of this component may result in a connection attempt hanging, which will require the machine to be restarted before the connection is released." If your application crashes for any reason and you don't properly dispose of the object before your app terminates, you will have to reboot to fix it. It's probably what you were experiencing with your device, especially if you were using DialAsync to perform the call.

This isn't something I can fix in the project either. This particular problem is an issue with Windows and working with applications that can terminate.

 

Hmmm..Thanks for that. But I read the documentation. I am disposing it properly.

"you will have to reboot to fix it."

- i also rebooting was not needed. Maybe my PC is just having delay in releasing the connection because I solved it by just plug/unplug the device.