Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Tuesday, November 22, 2011

Side by Side Configuration Incorrect


Source 
What Is SXSTRACE.EXE?

SXSTRACE.EXE plays a key role in the Windows operating system. SXSTRACE.EXE is a vital process which executes dll files and locates their libraries into windows system's memory. If SXSTRACE.EXE error occurs on your PC then the whole system would run unstably and be quite slow. 
Process SXSTRACE.EXE is located in the system directory
C:\windows\system32.
If the SXSTRACE.EXE process executes and runs from any other suspicious locations, it may be caused by Trojan virus, and then youd better fully scan your computer with an anti-virus program.
Repair SXSTRACE.EXE error
If it is a virus that destroys your SXSTRACE.EXE or, if for some other reason, your SXSTRACE.EXE is corrupt or gets accidentally removed; you need to take the following action to fix SXSTRACE.EXE error:

Locate a Copy of SXSTRACE.EXE on Your System

Check if you find a copy of SXSTRACE.EXE in the folder C:\windows\system32\dllcache or in C:\windows\ServicePackFiles\i386
.
If this is the case, go ahead and copy SXSTRACE.EXE to the system folder C:\windows\system32
If you don't find a copy on your system, you can try to find the file on your windows installation disks.
 

Most of the developers using assemblies in their application may have faced this issue. While starting an application, we may get an error “This application has failed to start because its side by side configuration is incorrect”.
Introduction
Side by side configuration is a trick for versioning files, in which multiple versions of a file are installed in a single machine. This is achieved through manifest files. E.g.: the C Runtime Library assembly contains three DLLs—msvcr80.dll, msvcm80.dll and msvcp80.dll — and is used by applications when they are built using functions from the CRT library. Side-by-side technology is also known as WinSxS or SxS.
What is Side by Side Configuration?
A side-by-side assembly contains a collection of resources—a group of DLLs, Windows classes, COM servers, type libraries, or interfaces—that are always provided to applications together. These are described in the assembly manifest.
Why is it Important?
In many cases, it is possible to update existing applications to use side-by-side assemblies without having to change the application code. Developers are encouraged to use side-by-side assemblies to create isolated applications, and to update existing applications into isolated applications for the following reasons:
  • Side-by-side assemblies reduce the possibility of DLL version conflicts.
  • Side-by-side assembly sharing enables multiple versions of COM or Windows assemblies to run at the same time.
  • Applications and administrators can update assembly configuration on either a global or per-application configuration basis after deployment. For example, an application can be updated to use a side-by-side assembly that includes an update without having to reinstall the application.
How is it Working?
In the preceding example shown in above picture, both Comctl32.DLL version 6.0 and Comctl32.DLL version 5.0 are in the side-by-side assembly cache and available to applications. When an application calls to load the DLL, the side-by-side manager determines whether the application has a version dependence described in a manifest. If there is no relevant manifest, the system loads the default version of the assembly. For Windows XP, version 5.0 of Comctl32.DLL is the system default. If the side-by-side manager finds a dependence on version 6.0 stated in a manifest, that version is loaded to run with the application.
Is it Related Project Settings?
We have to check if it is possible to resolve with project settings because EXE will run in debug build and fails to start in release build. Change your project settings to not use the runtime library, but this will make the output EXE bigger. (Project Properties -> C/C++ -> Code Generation -> Runtime Library -> use/MT or /MTd depends on your current configuration.) This may work, but it is not the solution for this issue.
Is it OS Related?
No, it is not an OS related issue. Since most of the experiences for this issue are in Vista, initially I thought it is only in Vista machine. Side by side error will come irrespective of OS, if reference assembly is missing from Sxs folder.
What is the Solution?
Now we need to think about the solution for this. Since the error message itself is saying “Please check windows event viewer for further information”. Go to event viewer and check for entry with sidebyside. Here we will take an example:
"Activation context generation failed for “DataViewer.dll". Dependent Assembly Microsoft.VC90.MFC, processorArchitecture="x86", publicKeyToken="1fc8b3b9a1e18e3b", type="win32", version="9.0.21022.8" could not be found. Please use sxstrace.exe for detailed diagnosis."
Here we are clear with what we are missing. We are missing 9.0.21022.8 version of Microsoft.VC90.MFC. You can go to C:\Windows\WinSxs folder and manually verify this dependent assembly is there or not. Since we are missing an assembly, the only solution is that reference assembly should be in the machine we are running our application on. Since we need to install dependent assembly to our client machine, we need to run Microsoft redistributable package for the required assembly to client machine. See section website for patches for downloading packages.
Are Sxstrace.exe Tools Useful?
This tool helps us for detailed diagnosis such as assembly probing steps. It also help us to identify what all are the previous versions available and loaded by the application and which folder it is currently searching for.
How Can I Use sxstrace.exe?
For running sxstrace.exe, go to Visual Studio command prompt and type sxstrace.exe. Usage is as follows:
  1. Before running your application, run sxstrace in trace mode sxstrace.exe Trace -logfile:C:\tmp\MySxSTrace.log
  2. Reproduce the error by starting your application
  3. Now stop the trace by using the below command sxstrace.exe Parse -logfile:C:\tmp\MySxSTrace.log -outfile:C:\tmp\MySxSTrace.txt
  4. Open output file from C:\tmp\MySxSTrace.txt
Website for Patches
Conclusion
Side by side configuration error comes because of the referenced assembly missing from winsxs folder. There is no code change for this issue, we can install the required patches to client machine and rebooting the PC will resolve this issue.

No comments: