none
HelpViewer2: CacheLibBadPackageException during help content silent install

    Question

  • I have created several documented .NET library assemblies. Since help content must be digitally signed for silent installation with HlpCtntMgr.exe, I have done the following for each of the assemblies:

    1. Document classes and class members with XML comments
    2. Generate HelpViewer2 .msha and .mshc files with SandCastle Help File Builder (v2015.10.10, latest)
    3. Use makecab.exe to store the .mshc file in a .cab file
    4. Update the .msha file to refer to the .cab file
    5. Use SignTool.exe to digitally sign the .cab file (SHA256 signature)

    All help packages can be silently installed without any problems using HlpCtntMgr.exe, except for one package. Installing that package fails with two error events logged in the Windows Application event log:

    Event #1 (source = HlpCtntMgr, Event ID = 1105):
    An error occurred while updating content on your computer:
    Microsoft.VisualStudio.Help.CacheLib.CacheLibBadPackageException: C:\ProgramData\Microsoft\HelpLibrary2\Catalogs\VisualStudio11\Incoming\Cab\AbsDeviceRhythmstickData.cab
       at Microsoft.VisualStudio.Help.CacheLib.DocumentationCache.<>c__DisplayClass8c.<VerifyAndExtractCabPackages>b__8a(ContentDownloadOperation op)
       at Microsoft.VisualStudio.Help.CacheLib.Extensions.Each[T](IEnumerable`1 that, Action`1 lambda)
       at Microsoft.VisualStudio.Help.CacheLib.DocumentationCache.VerifyAndExtractCabPackages(String vendorName, IEnumerable`1 downloadOperations, String workingDirectory, CancellationToken ct, StatusCallback`1 statusCallback, CertificateCheckCallback certCheckCallback)
       at Microsoft.VisualStudio.Help.CacheLib.DocumentationCache.VerifyAndExtractPackages(String vendorName, ChangeDescription change, CancellationToken ct, StatusCallback`1 statusCallback, CertificateCheckCallback certCheckCallback)
       at Microsoft.VisualStudio.Help.CacheLib.DocumentationCache.IntegrateChange(UpdateFileMove updateFileMove, ChangeDescription change, CancellationToken ct, StatusCallback`1 statusCallback, CertificateCheckCallback certCheckCallback)
       at Microsoft.VisualStudio.Help.CacheLib.DocumentationCache.Update(Boolean checkForOnlineUpdates, CancellationToken ct, StatusCallback`1 statusCallback, CertificateCheckCallback certCheckCallback, Uri source)
       at Microsoft.VisualStudio.Help.ContentManager.ContentManagementFunction.Install(Object data, CancellationToken cancellationToken)

    Event #2 (source = HlpCtntMgr, Event ID = 1003):
    Help Content Manager exited with error: FailOnInstall

    Unfortunately nothing is logged about why CacheLib thinks the package is bad.

    A few more observations:

    • The problems occurs equally with Help Viewer 2.0 (VS2012), 2.1 (VS2013) and 2.2 (VS2015)
    • The failing help content package can be installed interactively in the Help Viewer without
      any problems.

    I have no idea what the exact cause of the exception is. I have checked the .cab file checksum and signature and both are OK. I have researched the Internet and only got a handful of search results using Google and other search engines, none of them being anywhere close to helpful. Currently I am at wit's end with this problem. Not knowing the (root) cause of the problem makes it impossible to fix.

    Any help or insight is appreciated.

    Regards,
    -Roger

    Tuesday, March 08, 2016 11:14 AM

Answers

  • Update: 2016/03/21

    I thought I could get things to work by using a different help package file name. I tried virtually everything, including shorter file names, files names with all caps, file names without any non-alpha characters and a combination of these to no avail. Only then I found out that installing individual help packages works, but that installing several help packages back to back fails as outlined in the opening post. Bummer!

    Theory: I suspect that in the failing scenario some resource is locked when Setup API iterates the .cab file and extracts the .mshc file. If that resource is released over time, just waiting a few seconds might suffice to fix the problem. I have not researched this in full detail, but it would fully explain the weirdness that I have described elsewhere in this thread.

    Solution: I finally got things to work by bundling all help content packages in a single help book (one .msha file, multiple digitally signed .cab files). HlpCtntMgr.exe is now called only once. No more failures. This method has the additional advantage that installing the help content takes much less time now. Our customers will like that for sure!

    As to the root cause of the problem: there is apparently an issue (timing?) in either the Help Viewer system or in the Setup API that should be fixed. The issue only seems to exist when installing multiple help packages back to back. Microsoft: also please make errors like these more informative by including information about the reason of the error.

    I'd like to thank those who spent some of their valuable time to help (both here and elsewhere) for their remarks. While in the end not providing a factual solution, these remarks made me think different and finally succeed.

    Regards,
    -Roger

    Thursday, March 17, 2016 10:18 AM

All replies

  • Hi Roger,

    >>Help Content Manager exited with error: FailOnInstall

         Unfortunately nothing is logged about why CacheLib thinks the package is bad.

    According to the error message in Event 2, the package seems broken. Please try generated and sign again to check whether it can be fixed.

    And other packages are all installed successfully and this problematic package can't install to other version of Visual Studios. So I think the most problem is in this package itself.

    If there has a lot of content in your package, I suggest you add the content part by part, which can help us troubleshoot which part of content causes this issue.

    Best Regards,
    Weiwei

    Wednesday, March 09, 2016 3:29 AM
    Moderator
  • I have recreated the package several times with identical results. Now brace for something really weird:

    • I rename the original folder where the package is stored
    • I create a new folder with the same name as the original folder
    • I copy the package into the new folder
    • I verify that directory/file ownership and permissions are identical
    • I install the package from the new folder: SUCCESS
    • I install the package from the renamed original folder: FAIL

    I have also done some really deep investigation into where exactly the failure occurs. The bottom line (unfortunately I cannot disclose all the details here) is that HlpCtntMgr.exe throws the exception when extracting the .mshc file from the cabinet, so before reading the .mshc file content (this is also what the exception stack trace suggests). It is therefore irrelevant whether the .mshc file contains valid HTML content.

    There must be something different with the directories (see above) that makes HlpCtntMgr.exe fail. But what???

    Regards,
    -Roger

    Monday, March 14, 2016 12:37 PM
  • You didn't mention what the failing folder name was.  Help Viewer doesn't like periods, pound signs, or ampersands in the folder or filename and they can cause some odd issues resulting in a failure to install.  More likely than not you're running into something like that since changing the folder name makes it work.

    Eric

    Monday, March 14, 2016 3:21 PM
  • The failing folder path is "C:\Program Files (x86)\MyDiagnostick\MyDiagnostick SDK". It does not contain any periods, pound signs or ampersands.

    Please note (see my previous post) that installing from a newly created folder with exactly the same path makes the install succeed. Also, that fact that the other packages install just fine from the same folder suggests that the folder path is probably not the issue. When I rename the failing folder then installing the package from the renamed folder still fails.

    Regards,
    -Roger

    Tuesday, March 15, 2016 7:57 AM
  • Hi Roger,

    >>Please note (see my previous post) that installing from a newly created folder with exactly the same path makes the install succeed

    Please check the Properties of that failed folder and successful folder, whether there has any difference between them. And according to the path, there has spaces in it. Please try move the spaces from the path to make sure whether it is the reason.

    Best Regards,
    Weiwei

    Wednesday, March 16, 2016 1:37 AM
    Moderator
  • Hi Wei Wei,

    Folder properties are identical, including (advanced) attributes. Installing from a path with no spaces does not make any difference. Maybe there is more that I can see with normal tools.

    Regards,
    -Roger

    Note: I have a workaround now (see my reply to the opening post).

    • Edited by RogerHunen Thursday, March 17, 2016 10:19 AM
    Thursday, March 17, 2016 10:16 AM
  • Update: 2016/03/21

    I thought I could get things to work by using a different help package file name. I tried virtually everything, including shorter file names, files names with all caps, file names without any non-alpha characters and a combination of these to no avail. Only then I found out that installing individual help packages works, but that installing several help packages back to back fails as outlined in the opening post. Bummer!

    Theory: I suspect that in the failing scenario some resource is locked when Setup API iterates the .cab file and extracts the .mshc file. If that resource is released over time, just waiting a few seconds might suffice to fix the problem. I have not researched this in full detail, but it would fully explain the weirdness that I have described elsewhere in this thread.

    Solution: I finally got things to work by bundling all help content packages in a single help book (one .msha file, multiple digitally signed .cab files). HlpCtntMgr.exe is now called only once. No more failures. This method has the additional advantage that installing the help content takes much less time now. Our customers will like that for sure!

    As to the root cause of the problem: there is apparently an issue (timing?) in either the Help Viewer system or in the Setup API that should be fixed. The issue only seems to exist when installing multiple help packages back to back. Microsoft: also please make errors like these more informative by including information about the reason of the error.

    I'd like to thank those who spent some of their valuable time to help (both here and elsewhere) for their remarks. While in the end not providing a factual solution, these remarks made me think different and finally succeed.

    Regards,
    -Roger

    Thursday, March 17, 2016 10:18 AM
  • Hi RogerHunen,

    I'm glad that you have a workaround to resolve your problem and thanks for sharing your workaround here. Please mark your workaround as answer, which is benefit to other communities.

    If any questions about Visual Studio IDE in future, please feel free to come back to our forum.

    Best Regards,
    Weiwei

    Friday, March 18, 2016 1:14 AM
    Moderator