This project is read-only.

DOTRAS Problem on Windows 7

Feb 15, 2010 at 11:27 AM

Hi, I have used dotras.dll (WIN2K) and if I run it on a freshly installed windows 7 machine I get the error that the path to the phonebook is not found. Then I manually create a phonebook entry and then a new error is reported:

************** Exception Text **************

System.ArgumentException: 'deviceType' cannot be a null reference or empty string. Parameter name: deviceType
at DotRas.ThrowHelper.ThrowArgumentException(String argumentName, String resource,Object[] args)
at DotRas.RasDevice.Create(String name, String deviceType
at DotRas.RasHelper.GetEntryProperties(RasPhoneBook phoneBook, String entryName)
at DotRas.RasEntryCollection.Load()
at DotRas.RasPhoneBook.Open(String phoneBookPath)
at DotRas.RasPhoneBook.Open(Boolean openUserPhoneBook)
at DotRas.RasPhoneBook.Open()


Any ideas?


Thorben Jensen



Feb 15, 2010 at 3:24 PM
Edited Feb 15, 2010 at 3:30 PM

Yes, that issue with 1.1 has already been identified and fixed for the 1.2 release. Just grab latest from the source code and compile it yourself from the make.bat file. You might need to turn some knobs in the file to get it to compile properly, the help generator and some other things I have might be missing, just need to set them to false.

- Jeff

Edit: The issue with the phone book not found error was documented on the download page under known issues. If you have file monitoring for the phone book enabled (which it is on by default) and try to open the phone book when the folder doesn't exist it will throw that error. To fix it, you simply need to do a System.IO.Directory.Exists for the path of the phonebook you're going to create, and create the directory if it isn't already there. This issue should already be fixed by getting latest from the source code as well.

Feb 15, 2010 at 3:58 PM

Hi jeff,

Thank you very much - when will DotRas 1.2 be released?


Feb 15, 2010 at 4:54 PM

I still need to finish adding support for Windows 7, which is my highest priority with the release. I've completed all of the structure changes, but I still have a couple new APIs I need to implement. With that said, I don't have a projected release date at this point in time. My free time lately has been very limited due to high priority builds at work. Hopefully within the next few weeks work will slow to a normal pace so I can devote some time to the project.

If you'd like to be notified when 1.2 is released, just follow the project on Twitter as shown on the home page.

Jun 8, 2010 at 5:40 PM
Edited Jun 8, 2010 at 5:41 PM
I have this same issue on a Windows 7 but I found this and it's funny: If I restart the computer and then launch my program I get the same error "System.ArgumentException: 'deviceType' cannot be a null reference or empty string.". The PhoneBook path is correct, the file is there, permissions are ok, etc. BUT if I manually connect a VPN through the Windows 7 network icon and disconnect it (or even leave it connected), after that every launch attempt of the program is successful, and the program works correctly. Now that's weird, huh? I wonder if this bug was already resolved so if I compile the 1.2 source code myself it'll work in a "freshly restarted" Windows 7 system. Regards.
Jun 9, 2010 at 3:43 AM

I'd need a stack trace to confirm, but if it's the problem I'm thinking of yes it has been identified and fixed for the 1.2 release.

Jun 9, 2010 at 6:14 PM
Edited Jun 9, 2010 at 6:15 PM
(I hope newlines work in this post this time) Jeff, I didn't include the stack trace because it's identical than the one Thorben posted, sorry about that (also because new lines aren't working in my post, I'm using Firefox and that's weird). So I went and grabbed the last source (59566) and compiled it for WIN7 only. It worked perfectly, no "deviceType" bug. Then I tried to compile it for WINXP and failed at first because Internal/Utilities.cs has a function called SetRasIkeV2Options() that references NativeMethods.RASIKEV2 that is not built for WINXP. So I put that function under a "#if (WIN7)" section and compiled nicely. Using the WINXP DotRas.dll also works in Windows 7 and the "deviceType" bug isn't there anymore. Thank you very much! (and no, newlines didn't work).
Jun 9, 2010 at 9:35 PM

Yeah, that bug has been fixed.

Thanks for reporting the compile problem, I usually see those when I'm prepping for release builds since I have the build file run through everything and all tests.

Aug 11, 2010 at 5:32 AM

dear scorpius,

would you mind elaborating your solution more for me?

i have same problem and need urgent help.

can you send me you piece of code which vanishes the bug of "device type" in Win7 ?

waiting for you.

tanx millions.

Aug 11, 2010 at 3:15 PM

That just means you don't have a valid device for a connection. Just fix your connection through the Windows interface or through the RasPhoneBook class and it'll be fine.

Aug 14, 2010 at 6:52 AM
Edited Aug 14, 2010 at 6:57 AM

hi jeff, you know i got the following exception when opening my phonebook when a RasEntry exists already.

exception:  'deviceType' cannot be a null reference or empty string. Parameter name: deviceType

imagin you have not created any connection so far in your phonebook. it work perfectly when opening phonebook and dial correctly.

but when you create it and reboot the PC and try to open the phonebook after reboot, you got the exception.

and now, how i ran out of it. i just delete the connection from my Network Connection handy and when not any connection in phonebook exists and reopen the phonebook it just work well.

my solution to this is that when the exception thrown i catch it and enumerate the connection and delete my last created connection according  to its name and reopen the phonebook. is it a good and working solution for my problem or if any solution is existed?

Aug 15, 2010 at 4:12 AM

This particular issue has already been identified and resolved for the 1.2 release, as indicated on the 1.1 release page. If your device wasn't being corrupted it wouldn't be a problem, for whatever reason the device your entry is using isn't reporting a device type. Make sure you're using one of the string constants from the RasDeviceType class when you're creating the entry (if you're doing it manually). I personally wouldn't use the solution you proposed, just grab the latest copy of the source code and do a build yourself; the compilation instructions are on the Documentation tab.