Troubleshooting side by side issues using sxstrace

Side by side errors are troublesome to troubleshoot. You run an MFC/CRT application on customer machine and you run into error dialogs similar to the one shown below…

image

Don’t get overawed by the error. Its quite easy to troubleshoot, hmm well.

As the error message suggests let use sxstrace.exe. The usage of sxstrace is pretty easy to understand…

C:windowssystem32>sxstrace
WinSxs Tracing Utility.
Usage: SxsTrace [Options]
Options:
   Trace -logfile:FileName [-nostop]
       Enabling tracing for sxs.
       Tracing log is saved to FileName.
       If -nostop is specified, will not prompt to stop tracing.
   Parse -logfile:FileName -outfile:ParsedFile  [-filter:AppName]
       Translate the raw trace file into a human readable format and save the re
sult to ParsedFile.
       Use -filter option to filter the output.
   Stoptrace
       Stop the trace if it is not stopped before.
Example:  SxsTrace Trace -logfile:SxsTrace.etl
          SxsTrace Parse -logfile:SxsTrace.etl -outfile:SxsTrace.txt

The command usage message shows us two sample commands and that’s exactly what we’re going to try. Please make sure you’re running an elevated command prompt…

Run the following command…

C:>SxsTrace Trace -logfile:SxsTrace.etl
Tracing started. Trace will be saved to file SxsTrace.etl.
Press Enter to stop tracing…

So now you’re in tracing mode. Go ahead and run your application which threw the side by side error. Press enter on the command prompt window once you’re done repro’ing the error, this will stop the side by side tracing that’s going on. Once you press enter the ETL trace file will be dumped into the current folder. The dumped trace file is not in human readable format…

image

To make it readable, we’ll need to parse this file using sxstrace tool…

Run following command to do that…

C:>SxsTrace Parse -logfile:SxsTrace.etl -outfile:SxsTrace.txt
Parsing log file SxsTrace.etl…
Parsing finished! Output saved to file SxsTrace.txt.

So now we have a text file as output. Lets open the file and find out what went wrong… Contents are as follows…

image

I’ve annotated the above screenshot for your convenience. So basically side by side works based on version of a dll. All side by side binaries go in the winsxs folder located in C:Windows. For e.g. on my machine msvcr90d.dll is located in the following folder…

image

If you noticed, the folder name is made up of version number as well. So dll’s belonging to different versions are put in unique folders hence they exists “side by side” hence the name “side by side”.

So the above error means the application couldn’t find msvcr90d.dll in the above location. The way I would solve this is to create a setup project in VC9 and install the merge modules onto the target machine. Please note the dll’s are debug binaries else you could have just installed the redist’s.

Hope this will help you.

Appreciate your comments...