views:

93

answers:

1

Based on a previous question I posed (see here) and the following msdn threads, why does debugging fail when the full path of the vshost.exe is >= 127 characters?

To reproduce the issue create a project with a full path (directory + assembly name + vshost.exe) that is >= 127 characters. Then press F5 to start debugging and the program will exit immediately.

Note, my environment is Visual Studio 2008, C#, Windows XP, .NET 3.5 SP1.

+1  A: 

This is well known issue. The recommendation from MS for awhile has been to not use the default directories for project locations on XP / Vista. Specifically to create a "Projects" directory off of the root.

Incidentally, this is one of the primary reasons MS did away with the "Documents and Settings" folder in favor of "Users". They haven't been able to fix this for various reasons.

UPDATE

BTW, here is a little reading from our favorite host. Also, you might want to check out this MS article.

And, for kicks: https://connect.microsoft.com/VisualStudio/feedback/details/338223/envdte80-solution2-addfromtemplate-reports-path-too-long-incorrectly

The real point is that if your project folder + project name + 80 characters exceeds MAX_PATH then it won't work. They started really enforcing this to prevent buffer overflows in API parts that are not unicode compliant and therefore can't take advantage of 32,000 character paths.

Also, the enterprise library team ran into the same issues.

In the case of your vshost, consider the full pathing includes the 80 + 126 (which is 206) that leaves you with less than 54 characters for the other stuff that vshost requires on the line. Of course, you have to take the slashes and other things into account.

The simple answer is to just move your project or otherwise figure out how to reduce the paths.

Chris Lively
Shame they couldnt do away with "Program Files" at the same time. What was wrong with just "Programs" anyway?
Bear Monkey
Interesting, is there a KB article or another connect ticket (other than the one I just opened) that is related?
Taylor Leese
I definitely remember reading about this issue on an MSDN article somewhere. I have also come across a similar problem with Visual Studio disallowing me to create new solutions with very long paths. It needs to reserve characters for some reason. These issues must be interrelated. Ill post back if I can find the article.
Bear Monkey