I just installed C# Express Version 8.0.50727.42 and I have difficulty debuging applications with a project name length of 11 characters - if they are less than that I don't experience this problem:

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

Re: Visual C# IDE Help regarding Deployment


Could be a bad installation or something weird.  I have many projects longer than 11 characters in length and they compile and run just fine.  The error you gave is an access violation so somebody is referencing memory somewhere.  I'm not sure why however.

Michael Taylor - 11/11/05

Re: Visual C# IDE Help regarding Deployment



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\\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\\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\\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\\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\\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\\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\\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\\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\\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
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

Re: Visual C# IDE Help regarding Deployment


You could try disabling the vshost process.  In the IDE under your project settings of your EXE in the Debug tab you should see Enable Debuggers.  Uncheck the Enable the Visual Studio hosting process option.  Note that since you are running Express you may not have this option.  The hosting process is used by default in VS 2005 and provides a performance increase when debugging apps (supposedly). 

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

Re: Visual C# IDE Help regarding Deployment


Michael - thanks for your continued suggestions.

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:


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

Re: Visual C# IDE Help regarding Deployment


This is most peculiar.  The maximal path length is 260 characters on an NTFS volume.  Given the standard C:\ stuff you should have room for 256 characters.  Excluding the extension and period you'd have 252 characters.  It's definitely odd that 127 is approximately half of the limit which would almost seem to indicate that there was a problem with the Unicode buffer being used. 

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

Re: Visual C# IDE Help regarding Deployment

Rich S

Hello!  I have the SAME problem with my new installation of C# Express.  My executable name was 13 characters, and the error was the same access violation code.

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.


Re: Visual C# IDE Help regarding Deployment

Joe Morel - MSFT

I just attempted to recreate the error, and I wasn't successful.  I made it up to the limit before I encountered any errors.  I'll keep looking into it.

Re: Visual C# IDE Help regarding Deployment


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.

Re: Visual C# IDE Help regarding Deployment


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

Re: Visual C# IDE Help regarding Deployment


Just to let you know. Your other option would be to save the project in a location other than the default save directory that VS goes to. The overall problem really has more to do with the total length of the save directory plus the project name rather than the project name itself. I too have gotten nothing more than "we cannot reproduce this error" from Microsoft when I reported the problem. The crazy thing is, I work with Visual Studio 2005 Pro at my job and this problem does not exist. It's only on my machine at home...which leads me to think that there is something left over from the Express beta or some off the wall setting that is boogering the works.

Re: Visual C# IDE Help regarding Deployment

Brent VanderMeide - Architect

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)

  1. Do not use the 'My Documents' folder for the location of your solution & project files.
    • a. Try using a 'Dev' folder on your biggest hard drive.

  2. It's common to create DLL's after the namespace of which it's classes are in. Naming the project file after that fully qualified namespace will get you in this mess in a hurry.
    • When creating new projects, try naming it with an abbreviated version of the fully qualified namespace, and then changing it's output file to be the actually fully qualified name. There's also no need for you to include a company name in the project name. If you're creating code for clients, use their company name as part of the solution name.

    • example : Project Name : Utils.Security Output File Name: MyCompany.Utilities.Security.dll

If you follow these 2 rules you'll shorten your file paths dramatically, and avoid getting this error. Here's the difference below

c:\Documents and Settings\Brent VanderMeide\Local Settings\Application Data\Temporary Projects\MyCompany.Common\MyCompany.Utilities.Security\bin\Debug\MyCompany.Utilities.Security.dll


Best Regards,

Re: Visual C# IDE Help regarding Deployment


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 !

Re: Visual C# IDE Help regarding Deployment


I have made the changes from saving the project in My Documents. I now have it in C:\Development. The project no longer exits immediately when I run it with debugging. It works fine within the IDE.

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.

Re: Visual C# IDE Help regarding Deployment


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)