RasDevice.GetDevices() throws RasException (Win8 x64)

Oct 31, 2014 at 1:46 PM
I am trying to execute the following code:

var list = RasDevice.GetDevices();

Upon execution, it halts on this for around 30 seconds, and then throws a RasException (Error Code 1070).

There is no useful information in the stack trace. Any ideas?
Oct 31, 2014 at 1:54 PM
at DotRas.Internal.ThrowHelper.ThrowRasException(Int32 errorCode)
at DotRas.Internal.RasHelper.GetDevices()
at DotRas.RasDevice.GetDevices()
at DotRas.RasDevice.GetDeviceByName(String name, RasDeviceType deviceType, Boolean exactMatchOnly)
at VPNDialer.Form1.btnCreateConnection_Click(Object sender, EventArgs e) in c:\Users\gunwin\Desktop\VPNDialer\VPNDialer\Form1.cs:line 40
Oct 31, 2014 at 1:54 PM
Also thows error for: RasDevice.GetDeviceByName(String name, RasDeviceType deviceType, Boolean exactMatchOnly)
Nov 1, 2014 at 1:29 PM
That's not surprising, the two calls are both accessing the RasEnumDevices API under the hood, so if it's throwing that 1070 error that would definitely explain why both methods are throwing it.

Unfortunately since Windows is throwing the error it's going to be something specific with your machine and figuring out why RAS is throwing a 1070 error from that RasEnumDevices API I mentioned. According to WinError.h, that 1070 error code means:
// MessageText:
// After starting, the service hung in a start-pending state.
#define ERROR_SERVICE_START_HANG         1070L
There won't be much else I can do, this is the first time I've ever heard of it.