Keywords: Microsoft.Net, Visual Studio, -1073741819, file path name length
While developing a simple console application recently in Visual Studio, I encountered the error
The program ' LongNamedApplicationRpt.vshost.exe: Managed' has exited with code -1073741819 (0xc0000005).
The application builds fine, but when trying to run the application within the Visual Studio debugger (“F5”), it fails immediately and produces the above cryptic error. I am using Visual Studio 2005 (8.0) and the .Net Framework 2.0.50727, and the project output was for a Console Application in the Active(Debug) configuration. However, the application runs just fine from a command line.
As you might guess from my error message, the problem has to do with the length of the executable name. You can change the name of the generated application in the project properties by changing the “AssemblyName” in the Application tab. When the assembly name is 19 characters or more, the application won’t run using F5. Add “.exe” to the assembly name to get 23 characters, and add “.vshost.exe” (I think that’s a debug wrapper that actually runs when you hit F5) to get 30 characters. And add in the rest of the path name (mine was a ridiculously large 96 characters) and you’re getting suspiciously close to 128.
I dunno. I’m not naive enough to think that numerology of file name lengths has no effect, but I was surprised to get hit by it at by numbers as low as 128. Props to the folks at this thread at MSDN Forums. I found it with Google, but I guess I got lucky because the error number 1073741819 appears all over the place! My numerology is slightly different, but the basic approach worked.
Update: I verified that the length limit I’m hitting is really on the whole pathname and not just the file name. By reducing the patname by 24 characters, I was able to go up to 43 characters on the assembly name. However, when I went to recreate this error in a test environment, I failed to do so. Maybe it also has to do with command line parameters? Huh.