共用方式為


Help tracking down Win32 SxS manifest issues

Today I had my first experience with using manifest files for Win32 binaries. If you're only familiar with .NET manifest, never fear, as Windows itself uses essentially the same mechanisms.

In my particular case, I wanted to ensure that a DLL I wrote always linked to the latest and greatest DBGHELP.DLL in the same directory as the DLL. Without going into to much detail, suggestions like "just use a .local file", and "Just use LoadLibrary/GetProcAddress" weren't cutting it for me.

I'll save a detailed description of how I got to work till later. The important thing here was that I struggled for awhile to get the exact manifest XML syntax just right. When it wasn't correct, the loader would refuse to load the DLL, but wouldn't offer much more guidance on what was wrong.

Later in the day, I happened to be looking in the Event Viewer, and wandered through the "System" log just for fun. Lo and behold, I saw a bunch of red "Error" events sourced by "SideBySide". Opening these events up, I found a much more detailed description of what the loader didn't like. A typical entry:

"Syntax error in manifest or policy file "C:\projects\xxxx\Debug\Microsoft.XxxXxx.MANIFEST" on line 4."

So, next time you find yourself struggling with Win32 manifest, take a peek at the System events in the Event Viewer.

Comments

  • Anonymous
    April 12, 2005
    This is just part of the story.

    Sxs.dll logs information to System channel of Event Log. It does help in many cases to diagnose sxs manifest issues. But in many other cases, it reports partial informations leading you to nowhere. In other cases, it reports success, even though there is a clear problem since the process won't launch.

    I am working on improving the diagnosability of sxs issue. If you have suggestions, please drop me an email. You know how to contact me:)
  • Anonymous
    April 13, 2005
    Note, this applies only to Win2K3 and not XP.
  • Anonymous
    April 14, 2005
    stevewhitepsfd,

    Re: only working on Win2K3.

    Strangely, it worked for me on my XP, SP2 system.
  • Anonymous
    June 08, 2009
    PingBack from http://insomniacuresite.info/story.php?id=8137