together, since I won't have time to do a post edit on this entry.]
As powerful as WinSxS is, its not without its pitfalls. After adding a new
component to our install, I was hit with the application failing to start,
and this in the event log on XP:
Syntax error in manifest or policy file "C:\WINDOWS\WinSxS\Manifests\x86_MyCompany.MyLibrary_d032e2f1f5e7d70c_188.8.131.52_x-ww_f2eac902.Manifest" on line 2.
Syntax error? I haven't seen one of these since when regsvr42 made a bad file.
It had duplicate IID's. Well, mt.exe can validate syntax, lets check him:
C:\WINDOWS\WinSxS\Manifests>mt -manifest x86_MyCompany.MyLibrary_d032e2f1f5e7d70c
Microsoft (R) Manifest Tool version 5.2.3790.2075
Copyright (c) Microsoft Corporation 2005.
All rights reserved.
Parsing of manifest MyCompany.MyLib_d032e2f1f5e7d70c_184.108.40.206_x-ww_f2eac90
It validated... Well, first: its impossible to debug WinSxS under XP.
They added tools under vista/7 and added event log info for untangling these kinds of problems. Note: mt.exe only validates that the manifest is properly
formatted xml--not the contents.
I next ran my installer on Vista/7 so we can use sxstrace.
WinSxs Tracing Utility.
Usage: SxsTrace [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.
Stop the trace if it is not stopped before.
Example: SxsTrace Trace -logfile:SxsTrace.etl
SxsTrace Parse -logfile:SxsTrace.etl -outfile:SxsTrace.txt
Fire up SxSTrace in Trace mode, and then start your application.
After it crashes, stop the trace and parse it.
INFO: Parsing Manifest File C:\Windows\WinSxS\manifests\x86_mycompany.mylibrary_d032e2f1f5e7d70c_220.127.116.11_none_f4218a7198e4129a.manifest.
INFO: Manifest Definition Identity is MyCompany.MyLibrary,processorArchitecture="x86",publicKeyToken="d032e2f1f5e7d70c",type="win32",version="18.104.22.168".
INFO: Reference: Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.762"
INFO: Reference: Microsoft.VC80.MFC,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.762"
INFO: Reference: MyCompany.SomeOtherLib,processorArchitecture="x86",publicKeyToken="d032e2f1f5e7d70c",type="win32",version="22.214.171.124"
ERROR: Activation Context generation failed.
End Activation Context Generation.
ActCtx Generation defiantly failed with MyLib. Looks like it failed at SomeOtherLib though... (?)
Next (back on XP), load the MyLibrary.dll.manifest [in
\windows\winsxs\manifests] into notepad++, change the language to XML and
pretty print it with line breaks.
This time the syntax error came on line 73 of the manifest. The MSI
autorepair will restore the manifest, and require a reboot... at least
we got another data point.
Nothing looks too odd about that. The iid is unique in the file. I wonder
if it is not unique in the sum of all manifests?
Lets look at the other manifest that failed for that iid:
Ahhh... Look: two iids that are the same but in different manifests.
No wonder it failed. I'm surprised it even worked in COM/regsvr32.
I've changed the offending iid. Still not running. Lets redo the line breaking of the manifest to see if the line number of the error changed.
Ahhh... same problem different interface.
This children is why you never copy/paste IDL without changing the interface GUIDs!