This project is read-only.

System.ArgumentException PhoneBookPath cannot be a null...

Sep 29, 2009 at 4:33 PM


I am in need of a bit of help, i'm trying to use the DotRas code within a Vista environment and i followed the video tutorial and it doesn't seem to work.... probably missing something small!?


DotRas.RasEntry re = DotRas.RasEntry.CreateDialUpEntry("Test", phoneNumber, getModem(""));

                rasDialer1.EntryName = "Test";
                rasDialer1.DialCompleted += new EventHandler<DotRas.DialCompletedEventArgs>(rd_DialCompleted);
                rasDialer1.StateChanged += new EventHandler<DotRas.StateChangedEventArgs>(rd_StateChanged);
                rasDialer1.Timeout = 3000;
                rasDialer1.Disposed += new EventHandler(rd_Disposed);


This is the exception i keep getting back when i call the dial method above.


System.ArgumentException: 'PhoneBookPath' cannot be a null reference or empty string.
Parameter name: PhoneBookPath
   at DotRas.ThrowHelper.ThrowArgumentException(String argumentName, String resource, Object[] args)
   at DotRas.ThrowHelper.ThrowArgumentException(String argumentName, String resource)
   at DotRas.RasDialer.InternalDial(NetworkCredential credentials, Boolean asynchronous)
   at DotRas.RasDialer.DialAsync(NetworkCredential credentials)
   at Ras.RasConnection.dialpb()
   at Ras.RasConnection.Dial()

Any help on this would be much appreciated!


Thanks in advance



Sep 29, 2009 at 5:02 PM

There was a changed noted in 1.1 that the PhoneBookPath on the RasDialer is now required, that's all. That video was built with the 1.0 SDK, not 1.1. You can set the path yourself directly, or you can use the exposed static method on RasPhoneBook which will determine the path for you for the standard phone book locations.

rasDialer.PhoneBookPath = RasPhoneBook.GetPhoneBookPath(...);

Sep 30, 2009 at 9:21 AM

Thank you Jeff, sorry to bother you with such a simple problem!

Oct 1, 2009 at 6:33 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Oct 5, 2009 at 6:56 AM

Just a quick update:

I've changed the exception to throw something a bit more informative rather than the ArgumentException that was previously being thrown. Hopefully the new exception will aid developers understand where the issue is so they aren't left scratching their heads.