Welcome to MSDN Blogs Sign in | Join | Help

Troubleshooting C/C++ Isolated Applications and Side-by-side Assemblies - Scenario based with solutions

I am a support Engineer and has handled large number of cases related to C/C++ Isolated applications and side-by-side assemblies.

I came across different errors and is able to find resolution with the help of my Escalation Engineers. Here is the list of errors along with the solution. I hope this will help my team mates or users who has same set of errors.

I always suggest one to go thru http://msdn2.microsoft.com/en-us/library/ms235342.aspx .
In Most of the cases the above link is sufficient enough to find out the solution.

Scenario 1:

C Run-Time Error R6034
Error Message
"An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information."

In VC++ 2005, you need an application manifest to make use of the CRT (msvcr80[d].dll). If your application or DLL using CRT DLL doesn't have a manifest, you get this error.

Solution
Rebuild your application with a manifest
http://msdn2.microsoft.com/en-us/library/ms235560.aspx


Scenario 2:

Error Message
The application failed to initialize properly (0xc0000135).
This application has failed to start because the application configuration is incorrect. Reinstalling application may fix this problem.
The system cannot execute the specified program.


If a manifest is present in your application but a required Visual C++ library is not installed in the WinSxS folder, you may get one of the above error messages depending on the version of Windows on which you try to run your application:

Solution
Event viewer will have more details that will help us in finding a solution.


Scenario 3:

Error Message
This application has failed to start because MSVCR80.dll was not found. Re-installing the application may fix this problem.


Typically this error occurs because you are mixing retail and debug components. A very common scenario is a debug build of a application which is pulling in a retail version of a static library. The scenario could be the exact reverse and the error message in this case would reference msvcr80d.dll

Solution
This can be worked around by adding reference to retail CRT in the application manifest manually. Or by adding the following to a header.

#pragma comment(linker, "\"/manifestdependency:type='Win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='X86' publicKeyToken='1fc8b3b9a1e18e3b' language='*'\"")

Note: Proceed with caution when providing this solution.

Scenario 4:

ErrorMessage
Though there are no runtime errors,there might be errors in event viewer
like

Component identity found in manifest does not match the identity of the component requested Syntax error in manifest or policy file

"C:\Client\Microsoft.VC80.MFC.MANIFEST" on line 4. Generate Activation.Context failed for C:\Client\test.dll. Reference error message: The operation completed successfully

 

There are 2 bugs which cause this.

1. The assembly manifest of Microsoft.VC80.MFCLOC is incorrect. It has version 8.0.50727.42 instead of 8.0.50608.0.

Solution
Change the version number

<assemblyIdentity type="win32" name="Microsoft.VC80.MFCLOC" version="8.0.50727.42" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"/>


should be changed to
<assemblyIdentity type="win32" name="Microsoft.VC80.MFCLOC" version="8.0.50608.0" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"/>

2. Microsoft.VC80.MFCLOC is referenced not by the application but by MFC80[ud].dll
 
Solution
Microsoft.VC80.MFCLOC directory has to be under Microsoft.VC80.MFC directory and not at the same level.


Scenario 5:
Works in Windows XP but not in Windows Server 2003 or vice versa
. On Windows XP the stand alone manifest overrides the embedded manifest where as in Windows Server 2003 the embedded manifest always overrides the stand alone manifest.

It is recommended to have embedded manifest with correct information.
This will also avoid the overhead of shipping external manifest.

Scenario 6:
Can't find the MSM for ia64 under C:\Program Files\Common Files\Merge Modules.

Solution
Make sure you have installed one of the Team Editions and that you have selected the tools for building ia64 and merge modules in setup. The Professional SKU does not have ia64 support.

Scenario 7:
VS 2005 setup did not install the RTM version of MSM for libraries in \Program Files\Common Files\Merge Modules. Or the MSM under \Program Files\Common Files\Merge Modules indicate they are for beta2. In explorer, hovering over the VS 2005 MSMs shows tooltips which shows "WinSxS Beta 2".

Solution

This is bug in the MSMs. Even though there are RTM they were mislabeled with "WinSxS Beta 2".  The version should still show 8.0.50727.42. You can find the version by adding the MSM to a setup project and checking version under properties. There is a QFE which updates this label if customer needs it - KB 911884.

Published Friday, December 23, 2005 6:20 PM by jreddy

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Troubleshooting C/C++ Isolated Applications and Side-by-side Assemblies - Scenario based with solutions

Friday, September 22, 2006 3:38 PM by Ramanathan
This blog is really helpful

# re: Troubleshooting C/C++ Isolated Applications and Side-by-side Assemblies - Scenario based with solutions

Thursday, October 19, 2006 9:08 AM by Swapnil

I am facing a peciliar error in production. We have migrated our MFC apps to VS 2005 and now use MFC 8.0 libraries. We get the folowing error in event log:

Generate Activation Context failed for \\network\share\MFC80.dll. Reference error message: The operation completed successfully.

Please let me know if you have faced such an error.

Thanks in advance.

Swapnil

# re: Troubleshooting C/C++ Isolated Applications and Side-by-side Assemblies - Scenario based with solutions

Thursday, October 19, 2006 9:34 AM by jreddy

Are you able to run the application successfully?

If you are seeing errors only in event viewer, then the scenario 4 above may be applicable to you

# re: Troubleshooting C/C++ Isolated Applications and Side-by-side Assemblies - Scenario based with solutions

Wednesday, November 01, 2006 11:47 AM by Swapnil

The application freezes and is required to restart the app.

On some of the user's machines, we have to reboot. When this scenario occurs, we get that "Generate Activation Context failed" event log.

Thanks,

Swapnil

# re: Troubleshooting C/C++ Isolated Applications and Side-by-side Assemblies - Scenario based with solutions

Wednesday, November 01, 2006 12:09 PM by jreddy

I see that you are copying MFC80.dll into

\\network\share\.

Are you copying the manifest file also.

I mean Microsoft.VC80.MFC.manifest into the same folder.

# re: Troubleshooting C/C++ Isolated Applications and Side-by-side Assemblies - Scenario based with solutions

Wednesday, November 01, 2006 1:54 PM by Swapnil

yes it is in the same folder.

# re: Troubleshooting C/C++ Isolated Applications and Side-by-side Assemblies - Scenario based with solutions

Friday, November 17, 2006 8:09 AM by jreddy

would it be possible to have a repro using which i can simulate the problem?

# re: Troubleshooting C/C++ Isolated Applications and Side-by-side Assemblies - Scenario based with solutions

Friday, February 02, 2007 9:31 PM by Aris

Is it possible to statically link MFC and C libraries to application so i dont have to worry about manifest stuff ?

I have set of apps that worked fine and different machines after building with VS 2005 after i updated VS to SP1 it started throwing all kinda of different error (from side-by-side to just unable to execute and no error at all)

Apps were developed on XP but i usually want to run those on 2003

# re: Troubleshooting C/C++ Isolated Applications and Side-by-side Assemblies - Scenario based with solutions

Thursday, September 13, 2007 5:19 PM by Mike Blake-Knox

I've been troubleshooting a problem that happens when our ActiveX control is started if Acrobat Reader 8.1 is installed. Our dll is built with version 50727.42 of msvcr80.dll. It seems that Acrobat provides/uses version 50727.163 and causes Windows explorer to immediately load it once Acrobat is installed. If we try to load our module, an event (Generate Activation Context failed ... component version required by the application conflicts with another component version already active.) is generated.

This seems to result from the absence of a redirect for version .42 in the .163 policy file. It works fine if I add a redirect to the .163 policy file.

# re: Troubleshooting C/C++ Isolated Applications and Side-by-side Assemblies - Scenario based with solutions

Wednesday, October 03, 2007 1:31 PM by Eric Gentry

When will the merge modules for debugCRT be available to support the SP1 versions of msvc*80d.dll?

# re: Troubleshooting C/C++ Isolated Applications and Side-by-side Assemblies - Scenario based with solutions

Friday, October 05, 2007 8:28 PM by jreddy

you can do that but we recommend not to do that. By doing so you might miss security updates to the runtime dll's.

If you have compiled your app using vs2005 sp1 and run it on a different system where you dont have the latest version of dll's then you will get errors.

Please install vcredist_x86.exe (with sp1 changes) on your target system.

Let me know if you need further help

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker