Wednesday, June 21, 2006
« June 2006 Geek Dinner - June 29th, 2006 | Main | Service-Oriented Architecture Presentati... »

I was performing some routine debugging today and suddenly received a very strange error; one that I had not heretofore received:

Error while trying to run project: Could not load file or assembly 'TestApplication' or one of its dependencies. The module was expected to contain an assembly manifest.

When I attempted to run the application from Explorer I was greeted with the message:

C:\SomeBuildDirectory\TESTAP~2.EXE
The NTVDM CPU has encountered an illegal instruction.
CS:0e1b IP:0173 OP:65 63 74 69 6f Choose 'Close' to terminate the application.

Needless to day, I was a bit disconcerted.  I started to dig into to see what the problem was.

The very first thing I did was Google it.  The search yielded a page that seemed to fit the bill exactly.  A user by the name of PCarrier had experienced a very similar problem.  He had developed an application in C# and was getting the same result.  As it turns out, he had a virus.  Well, that was a possibility here, but I doubted it at first.  However, I decided to see for myself what was going on.

The next thing I did was investigate my Post-Build actions - this solution has several projects each of which has its own custom Post-Build action.  Nothing seemed out of place.

I then investigated the directory system.  I noticed was that in my \obj directory, the output .exe file was the proper 13K but in the \bin directory it was 6K.  The file was being truncated!

Therefore, I opened up FileMon and started monitoring for changes to that file and sure enough I saw some very erratic behavior.  It looked strange.  Several accesses to the file in the \obj folder were correct and they allocated the file properly but when it came time to write it to the \bin folder it looked like there was some ADS (Alternate Data Stream) stuff going on which was truncating the file to it's 6K size.

I started to suspect virus so I installed the AV software (yes, I didn't have any AV software running at this juncture) and ran a scan.  Nothing turned up.  I then ran the RootkitRevealer to see if anything cropped up there - nothing out of the ordinary.  Well, that was putting my mind at ease, but I was still facing the same problem.

Strangely, after doing the AV scan and Rootkit detection the ADS activity ceased.

I decided to retrace my steps to see if anything was amiss and started again to investigate the Post-Build actions and then (finally!) something stood out at me.  I had edited the macro to copy a shared configuration file and rather than copy the file to the target directory, I had mistakenly copied the configuration file to the target path (which includes the output .exe name)

The command I had was

copy $(SolutionDir)SharedConfiguration.config $(TargetPath)

And it should have been

copy $(SolutionDir)SharedConfiguration.config $(TargetDir)

Sometimes the little things get you.  I'm thankful that it was such a simple thing and that viruses didn't enter the picture, but I kick myself that I didn't suspect that the .exe file wasn't a valid one to begin with.  I should have opened the .exe in Notepad2 and the problem would have been clear from the start.

...but I can now rest at ease.

Friday, March 16, 2007 1:22:00 AM (Mountain Standard Time, UTC-07:00)
gr8!!

i was also facing this problem and after spening my half day i foudn this link :)

thanks :)
Tuesday, July 24, 2007 7:18:00 PM (Mountain Standard Time, UTC-07:00)
Hi, I have the exact same problem but I don't know how to make the change you suggest. Can you help me with a few simple instructions-steps for VS2005 Pro?
Tuesday, July 24, 2007 11:52:00 PM (Mountain Standard Time, UTC-07:00)
In Visual Studio .NET 2005, you need to do the following:

1. Open your project properties (e.g. right-click on the project, select properties OR Project --> Properties via the main menu)

2. Select the Build Events tab

3. Make sure that the Post-build event command line has the appropriate statements.
Thursday, October 11, 2007 8:29:00 PM (Mountain Standard Time, UTC-07:00)
Hi , I have This Problem too & i followed the steps u have told but i saw that i dont have any statement in the post-build event command line of my project.

can u help me what to do?
Amin Mobasheri
Tuesday, December 11, 2007 9:16:00 AM (Mountain Standard Time, UTC-07:00)
PLEASE ANYONE HELP ME OUT. I am getting this message when i run any application in Visual Studio.Net 2005. I have reinstalled Windows and also Visual Studio but still getting this message whenever i try to run my application.



MESSAGE IS:-



The application failed to initialize properly (0xc000007b). Click on OK to terminate the application.
ASH
Friday, April 04, 2008 3:07:00 AM (Mountain Standard Time, UTC-07:00)
Saludos,

tengo una aplicación en Developer Oracle 1.3.2. de repente ya no se puede ejecutar yaq ue se presenta el siguiente mensaje:



La aplicación no se ha podido inicializar correctamente (0xc000007b). Haga click en Aceptar para terminar la aplicación.



Si alguien me puede ayudar, se lo agradezco mucho
MCV
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, b, i, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview