次の方法で共有


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 https://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
https://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.

Comments

  • Anonymous
    September 22, 2006
    This blog is really helpful

  • Anonymous
    October 19, 2006
    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 \networkshareMFC80.dll. Reference error message: The operation completed successfully. Please let me know if you have faced such an error. Thanks in advance. Swapnil

  • Anonymous
    October 19, 2006
    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

  • Anonymous
    November 01, 2006
    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

  • Anonymous
    November 01, 2006
    I see that you are copying MFC80.dll into \networkshare. Are you copying the manifest file also. I mean Microsoft.VC80.MFC.manifest into the same folder.

  • Anonymous
    November 01, 2006
    yes it is in the same folder.

  • Anonymous
    November 17, 2006
    would it be possible to have a repro using which i can simulate the problem?

  • Anonymous
    February 02, 2007
    The comment has been removed

  • Anonymous
    September 13, 2007
    The comment has been removed

  • Anonymous
    October 03, 2007
    When will the merge modules for debugCRT be available to support the SP1 versions of msvc*80d.dll?

  • Anonymous
    October 05, 2007
    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