Example:
I created a new windows application project named: abcdefghijk and then immediately pressed F5. The following error is in the output window:
The program '[688] abcdefghijk.vshost.exe: Managed' has exited with code -1073741819 (0xc0000005).
Manually, I can go into the output directory (E:\Documents and Settings\Parents\Local Settings\Application Data\Temporary Projects\abcdefghijk\bin\Debug) and execute the abcdefghijk.exe and the application runs correctly (i.e. it pops up the form captioned Form1).
Does anybody have any ideas as to what the problem is
Thanks, Jeff

C# - Maximum Project Name Length
The Triggerman
A windows command length can only be 229 characters in length. I would assume that the .vshost.exe file is trying to run a command in which the full path of the .exe file is getting truncated therefore causing an error. There is a maximum length to files & folders as well.
2 Tips for Creating Projects in Solutions
(important to avoid massive headaches especially with teams)
If you follow these 2 rules you'll shorten your file paths dramatically, and avoid getting this error. Here's the difference below
ORIGINAL PATH:
c:\Documents and Settings\Brent VanderMeide\Local Settings\Application Data\Temporary Projects\MyCompany.Common\MyCompany.Utilities.Security\bin\Debug\MyCompany.Utilities.Security.dll
SHORTENED PATH:
c:\Dev\MyCompany.Common\Utils.Security\bin\Debug\MyCompany.Utilities.Security.dll
Best Regards,
rusk50
Some of the folders in the path are socalled 'hidden' so a search will not search these folders.
Try Control Panel, Folder settings, and check 'Show hidden files' and 'show system files'.
Now try browsing to something like this:
C:\Documents and Settings\username\Local settings\Apps\2.0
Note: 'Local settings' are localized ('Lokale Indstillinger' on my com)
venkyweb
Tirumala
Remember that Express products force you to use ClickOnce for distributing (and you can also use that from Visual Studio).
ClickOnce will install the product in a VERY deep directory structure under 'C:\documents and setttings\.........' (very bad design IMO).
So (according to ms documentation) you will only have about 100 characters left for your path, or you will eventually get a 'path too long' when your product is installed on end-user's machine.
According to the doc, this is partly a choise for 'SECURITY' reasons. That's right. How rediculous it may seem, it really says that !
Steve Cook
I wonder if there is a bug in the .NET runtime. The standard C++ path function limits components (your filename in this case) to 256 characters which is half of 127 (including the NULL terminator). Anything above this would fail. The .NET runtime is undoubtedly eventually using this or CreateFile to do the dirty work.
I tried to duplicate your problem but I got up to the 256 limit before I had any problems. When I did hit the limit I got an error saying the volume label was incorrect. Does the app generate any sort of error Are you running on an NTFS file system
Dudday
Thanks for the advice. Unfortunately, I have tried repairing and reinstalling. In fact here are the steps I used to reinstall:
1) Uninstalled C# Express, MSDN, SQL Server Express
2) Cleaned out temporary folder directories
3) Removed any V2.xx directories in C:\windows\Microsoft.Net\Framework
4) Rebooted
5) Ran RegClean and RegistryFixer
6) Rebooted
7) Reran RegClean and RegistryFixer
8) Rebooted
9) Reinstalled C# Express, MSDN, SQL Server Express
10) Rebooted
Then created a windows application used the default name hit F5 and got the same error:
'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApplication1.vshost.exe' (Managed): Loaded 'E:\Documents and Settings\Parents\Local Settings\Application Data\Temporary Projects\WindowsApplication1\bin\Debug\WindowsApplication1.vshost.exe', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Deployment\2.0.0.0__b03f5f7f11d50a3a\System.Deployment.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WindowsApplication1.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread 0x13cc has exited with code 0 (0x0).
The thread 0x13c4 has exited with code 0 (0x0).
'WindowsApplication1.vshost.exe' (Managed): Loaded 'E:\Documents and Settings\Parents\Local Settings\Application Data\Temporary Projects\WindowsApplication1\bin\Debug\WindowsApplication1.exe', Symbols loaded.
The program '[3888] WindowsApplication1.vshost.exe: Managed' has exited with code -1073741819 (0xc0000005).
And, not sure if this will help anyone but here is a listing of the files in my Microsoft.Net framework directory:
Directory of C:\WINDOWS\Microsoft.NET\Framework
11/12/2005 03:08 PM <DIR> .
11/12/2005 03:08 PM <DIR> ..
11/12/2005 03:08 PM 0 dir.txt
09/23/2005 07:28 AM 72,704 NETFXSBS10.exe
02/20/2003 05:44 PM 36,354 NETFXSBS10.hkf
09/23/2005 07:28 AM 41,392 netfxsbs12.hkf
09/23/2005 07:28 AM 7,680 sbscmp10.dll
09/23/2005 07:28 AM 7,680 sbscmp20_mscorwks.dll
09/23/2005 07:28 AM 7,680 sbscmp20_perfcounter.dll
09/23/2005 07:29 AM 5,120 sbs_diasymreader.dll
09/23/2005 07:29 AM 5,120 sbs_iehost.dll
09/23/2005 07:29 AM 5,120 sbs_microsoft.jscript.dll
09/23/2005 07:29 AM 5,632 sbs_microsoft.vsa.vb.codedomprocessor.dll
09/23/2005 07:29 AM 5,120 sbs_mscordbi.dll
09/23/2005 07:29 AM 5,120 sbs_mscorrc.dll
09/23/2005 07:29 AM 5,120 sbs_mscorsec.dll
09/23/2005 07:29 AM 5,120 sbs_system.configuration.install.dll
09/23/2005 07:29 AM 5,120 sbs_system.data.dll
09/23/2005 07:29 AM 5,120 sbs_system.enterpriseservices.dll
09/23/2005 07:29 AM 5,120 sbs_VsaVb7rt.dll
09/23/2005 07:29 AM 5,120 sbs_wminet_utils.dll
09/23/2005 07:28 AM 7,680 SharedReg12.dll
11/12/2005 11:00 AM <DIR> v1.0.3705
11/12/2005 01:46 PM <DIR> v1.1.4322
11/12/2005 02:48 PM <DIR> v2.0.50727
20 File(s) 243,122 bytes
Thanks, Jeff
Lynn33
You could also verify that you can manually launch the hosting process (not your app but vshost itself). You'll need to copy the binaries from the temporary directory after compilation but before you kill the IDE in order to prevent them from being destroyed. I'd run them straight from the same directory if possible. This would verify whether it is an IDE issue or a problem with the host process.
Michael Taylor -11/12/05
LarryWho
When I publish it, however, it still comes up for only a second and then disappears. This was the same problem I was having with the long file name projects when I ran it with the debugger. Because it uses ClickOnce, I have no idea where it has been installed (running a search didn't help). Is it still being buried so deep that it is ending up with a long file name
Why are some people having this problem and not others I can't imagine that everyone is having this problem with published output from the Visual Studio Express. Has anyone discovered a common factor among those who have this problem
I have considered upgrading to the full Visual Studio, but it has the same problem with long file names. Unless I had some assurance that it did not have this problem with ClickOnce as well, I wouldn't feel comfortable plopping down all that cash.
srinivas vasireddy
I can't believe that such an obvious, and easy-to-encounter bug slipped through. Maybe what all the blogs are saying is true: that Visual Studio was released with far too many bugs.
Anyway, I hope this gets fixed soon, as I am going to invest in the Professional edition next month.
Rich
rebus
First thank you Jeff for finding the cause for this error.
I first encountered this after installing VS C# Express Beta 2 on a clean system (no previous ms VS, Office, or servers), I'd also noticed it only occured when running vshost and not if that option was off or when running the bin exe - I reported it to ms but it got rebuffed with the standard "we cannot reproduce this error" response.
Now I've installed the release VS 2005 Pro and I'm having exactly the same error and I can confirm it occurs in any .net language, not just c#. It also goes away with a shorted name.
It's a shame this made it through beta - I wasn't the only one to report this bug but like most at the time I never thought of shortening the project name!
At least now there's a workaround until a hotfix is released.
Thanks, John
JamesHeiser
I tried your first idea and there was no difference.
Then I tried executing the application itself and it would not start. So for grins I copied the .exe into my c:\ directory and it ran. I then increased the filename length and the last filename which worked correctly was:
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890.exe
Which - if you prepend the c:\ is exactly 127 characters. As soon as I increase the length by 1 additional character the application no longer starts. So, the executable name, including the path, cannot be greater than 127 characters.
- Jeff
Porko
Andres C. Joaquin
Michael Taylor - 11/11/05
cbaldo1
Hi there!< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
I thought I would add to this post since some of the earlier comments solved the problem for me...sort of. For the last two nights after I got home from work I've lived in misery trying to get the debugger to work properly in my newly installed instance of C# Express and VB Express. I experienced virtually ALL of the problems that the people who contributed to this post did. So I got to looking and noticed that indeed, the names of my projects were more than 11 characters long. For the heck of it, I created a new project with a four character name and "magically" it worked. So for all intents and purposes this is a work around.
I did also find another post out there that recommended shutting off VSHost in the Debug options for the solution...this worked, for a while, but in the end the program reverted to it's old nasty behavior.
This appears to be a bug. Not a life shattering one, but one that can definitely keep you up later than you should be trying to figure out what's wrong with your debugger. So for the time being I would recommend to any of you out there experiencing this problem to keep your project names below 11 characters until MS can figure out where they went wrong and get us a fix.
Joe, I did have the C# Express beta on my machine prior to installing the shipping release if that helps. However, I did uninstall it before installing the shipping release.
Thanks everyone.