Error when using development time IIS support
Update: this bug has been fixed for a while now
I installed Visual Studio 2017.3 yesterday and was trying to used the new Development time IIS Support feature. I think I encountered a bug, and I was wondering if anyone knows a workaround this bug. When I used it with a new project it works fine most of the time. By most of the time, is that I think it is broken sometimes depending on the where the project is located/state of cached data, etc.
Sometimes I get an error "Value cannot be null. Parameter name: name". That's the entire error. No log files, no extra information.
- I tried to enable the feature for an existing project I am working on, it got that error.
- I tried adding a new web project in a new solution it worked fine. I tried adding a new web project in the same solution as my project, it didn't work.
- I deleted all temp files, all bin obj and .vs folders and .user files in the solution. Same problem.
- I deleted temp folder, visual studio user profile data, and restarted the PC same problem.
- I tried again in the same solution with the project not having '.' in the name, it worked.
- I did some modification to the project that was working and tried to launch again I got same error.
- I reverted all changes so that the project was back to the "empty project" state, still same error.
- I removed the project. Exited visual studio, deleted all temp/.vs/.use/bin/obj files. Then restarted and added the project again, it worked.
- I restarted VS and tried to relaunch it didn't work.
- The aspnet core version seems to be not related to the bug. I had the problem with projects targeting 1.1 and 2.0 and also had the feature working for both versions.
So obviously this is a bug in VS2017.3. Since even if I am doing something wrong I should at least get an error explaining what I do wrong not an ArgumentNullException message. I already made a bug report. I am wondering if someone knows a workaround thing bug.
Thanks a lot in advance.
Solution 1:
Update: This bug has been fixed for a while now.
After some investigation and with help from a helpful member of Microsoft's Visual Studio Team, I found that Visual Studio was failing at the point where it grants folder read access to the IIS App Pool account. The method that gets the App Pool account name was returning null, and when that null value was passed to the System.Security.Principal.NTAccount class constructor, the ArgumentNullException is thrown.
A workaround that fixed the problem for me, was changing the App Pool to any other App Pool, trying to launch, then changing it back to the original/desired App Pool.