Preview Handler in MSIX

MVP

I have a preview handler that works natively and am trying to create an MSIX package for it.  Here is an example of it working after native installation:

Example output of Native Preview Handler.Example output of Native Preview Handler.

 

This is a 64-bit shell extension with a native registration that looks like this:

TIMOTHYMANGAN_0-1678134828880.png

The 8895b1c6 GUID is the well-known 64-bit identifier for "Preview Handler".

The A141580D is the app specific COM in-proc GUID.

The 85D6AF6F GUID is for the well-known AppID of the system proxy prevhost.exe.

 

As the package consists of just the preview handler, I had to add a dummy application/exe into the Manifest (without start menu display) and so the applications section that I have looks like this:

<Applications>
    <Application Id="NONAPPLICATION" Executable="NonApplication.exe" EntryPoint="Windows.FullTrustApplication">
      <uap:VisualElements BackgroundColor="transparent" DisplayName="Non Application" Square150x150Logo="Assets\StoreLogo.png" Square44x44Logo="Assets\StoreLogo.png" Description="Placeholder for package extensions that must be registered to an application." />
      <Extensions>
        <com:Extension Category="windows.comServer">
          <com:ComServer>
            <com:SurrogateServer DisplayName="8895b1c6-b41f-4c1c-a562-0d564250836f" AppId="85d6af6f-788c-4845-8fd6-aaf1f2fa561c">
              <com:Class Id="a14a580d-73a7-4a19-80b1-75f455020bdd" Path="VFS\ProgramFilesX64\TMurgentMsixPreviewHandler\MsixPreviewHandler.dll" ThreadingModel="STA" />
            </com:SurrogateServer>
          </com:ComServer>
        </com:Extension>
        <uap:Extension Category="windows.fileTypeAssociation">
          <uap:FileTypeAssociation Name="msix">
            <uap:SupportedFileTypes>
              <uap:FileType>.msix</uap:FileType>
            </uap:SupportedFileTypes>
            <desktop2:DesktopPreviewHandler Clsid="a14a580d-73a7-4a19-80b1-75f455020bdd" />
          </uap:FileTypeAssociation>
        </uap:Extension>
      </Extensions>
    </Application>
  </Applications>

 

And this does not work. It installs, but when you try to use it no display appears.  Procmon indicates that explorer seems to know about it, but the dll is never loaded from disk, nor is there any sign of a prevhost.exe process. 

 

It is unclear from the documentation if I am missing something.  I certainly cannot add a COM proxy server entry in the package since prevhost.exe is part of the native OS and not the package.

 

Any idea on how to get this specified correctly?

2 Replies
Update with more detail. I did locate an error in the Windows event log "AppModel-Runtime" that identified this package under test. The Event ID is 69 with details:

"Failed with 0x490 modifying AppModel Runtime status for package ... (current status-0x0, desired status - 0x20)."

0x490 is "ERROR_NOT_FOUND", so it seems likely that the runtime was looking for something, although what I don't know.

@Aniket_Banerjee You requested the app installer for this.  I will attach a zip containing the files and a powershell script used during the package capture.  There are two dependencies which I am trying to put into the package, but keeping them external does not change the results.  I removed the dependency installers from the zip as it's too big but you'll see them referenced in the powershell script.

 

Since posting the manifest shown in the original post, I altered the manifest to eliminate the AppID on the surrogate and use SystemSurrogate="PreviewHost", but same results also.  I'll also note that the EnableShare options on the DesktopPreviewHandler isn't well described in the docs (and doesn't tie to anything in the native registration)  so I'm not sure what (if any) option should be set but I tried a few options that all fail.