Help Library Agent exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary

HelpLibAgent.exe crashes while accessing the help feature in Visual Studio 2010 on a Windows 7system.

Based on the app evt log I found the following stack trace:  

.NET Runtime version 2.0.50727.4927 – Profiling flag set, but required environment (COR_PROFILER) was not set.

Faulting application name: HelpLibAgent.exe, version: 1.0.30319.1, time stamp: 0x4ba21585

Faulting module name: KERNELBASE.dll, version: 6.1.7600.16385, time stamp: 0x4a5bdaae

Exception code: 0xe0434352

Fault offset: 0x00009617

Faulting process id: 0xcfc

Faulting application start time: 0x01caebbf97f03542

Faulting application path: C:\Program Files\Microsoft Help Viewer\v1.0\HelpLibAgent.exe

Faulting module path: C:\Windows\system32\KERNELBASE.dll

Report Id: d81a6ae2-57b2-11df-8888-001676c5f454

Application: HelpLibAgent.exe

Framework Version: v4.0.30319

Description: The process was terminated due to an unhandled exception.

Exception Info: System.Collections.Generic.KeyNotFoundException


Server stack trace:

   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)

   at Microsoft.Help.ProtocolHandlerPool.ReturnProtocolHandler(Guid protocolId, Boolean destroy)

   at Microsoft.Help.InvisibleWindow.HandleHttpRequest(Object sender, HttpRequestEventArgs e)

   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)

   at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

   at Microsoft.Help.HelpHttpServer.IncomingRequestCallback(System.IAsyncResult)

   at System.Runtime.Remoting.Messaging.AsyncResult.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage)

   at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessageSink)

   at System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.DoAsyncCall()

   at System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.ThreadPoolCallBack(System.Object)

   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object)

   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)

   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()

   at System.Threading.ThreadPoolWorkQueue.Dispatch()

   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

.NET Runtime version 4.0.30319.1 – Loading profiler failed.  COR_ENABLE_PROFILING was set properly, but COR_PROFILER was not.  COR_PROFILER must be set to the CLSID of the profiler to load.  Process ID (decimal): 3324.  Message ID: [0x2500].

Help Library Agent exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary

After analyzing the issue, I found that the local store (C:\ProgramData\Microsoft\HelpLibrary) was corrupted  because:

1.       No books are mapped in Scopes.xml
2.       No packages are present
3.       No catalog partitions are present

To fix the problem please follow these steps:

1.       Go to helplibmanager.exe.config C:\Program Files\Microsoft Help Viewer\v1.0\
2.       open helplibmanager.exe.config (in notepad.exe)
3.       change key="FirstTimeRun" value="False" to key="FirstTimeRun" value="True
4.       Run Help Library manager again from shortcut or IDE => help menu and it should give you a dialog to setup new content local store and you can install content from media or online.

You may also find the following error message in the app evt log:

An error occurred while updating local content: Microsoft.Help.CacheLib.CacheLibDownloadException: An error occurred while the BITS service was transferring ‘’ to ‘C:\ProgramData\Microsoft\HelpLibrary\content\Microsoft\incoming\0b2898b2-71b6-4fe1-b6f6-58e1df779364\’. The error context was ‘RemoteFile’, and the error code was ‘0x80200013’.
   at Microsoft.Help.CacheLib.DocumentationCache.<>c__DisplayClass6c.<DownloadWebContent>b__69(IGrouping`2 chunk)
   at Microsoft.Help.CacheLib.Extensions.Each[T](IEnumerable`1 that, Action`1 lambda)
   at Microsoft.Help.CacheLib.DocumentationCache.DownloadWebContent(IEnumerable`1 webDownloads, Int32 totalDownloads, Int32 completedDownloads, String workingDirectory, StatusCallback`1 statusCallback)
   at Microsoft.Help.CacheLib.DocumentationCache.Download(ChangeDescription change, StatusCallback`1 statusCallback)
   at Microsoft.Help.CacheLib.DocumentationCache.Update(VendorName vendorName, Boolean checkForOnlineUpdates, StatusCallback`1 statusCallback, CertificateCheckCallback certCheckCallback)
   at Microsoft.Help.CacheLib.CacheManager.<>c__DisplayClass24.<UpdateAsync>b__23()
   at Microsoft.Help.CacheLib.AsyncOperationRunner.Run(Object state)

This issue can occur if the proxy server does not support HTTP 1.1 range request. There is a Windows update support article with details on this error and here the quote that describes the bits error: Error 0x80200013 BITS can request ranges of updates. If the network proxy or firewall device does not support range requests, BITS cannot download updates. Therefore, BITS returns the 0x80200013 error code. When this problem occurs, the %windir%\Windowsupdate.log displays the following entry: Download job failed due to insufficient range support. To resolve this problem, contact the vendor of the network proxy or firewall device.

And here is the quote from BITS documentation explaining this:

When you copy a file by using BITS in background mode, the file is copied in multiple small parts. To perform this kind of copy operation, BITS uses the HTTP 1.1 Content-Range header. If you are behind a proxy server or behind a firewall that removes this header, the file copy operation is unsuccessful.

In order to fix the issue, we need some other proxy or get the proxy settings updated.

Comments (1)

  1. Hello

    I have a similar crash problem with HelpLibManager.exe, in VS C# 2010 Express running under Win 7 64 bit:

    This happened when I tried (more than once) to install content from online from the Help Library Manager, selecting '.NET Framework 4' (tried with 3.5 also). The download of 590 Mb comes through OK but the crash occurs when 'Merging Index'

    Installation of smaller help files like 'Web Development' or 'Service Development' have worked OK – i.e installed content from online without problem.

    I very much want to install this framework help locally but not winning. Your help will be much appreciated.

    Do you know location of  the downloaded files in my hard disk – I can at least try viewing them using H2Viewer.

    the crash details from event log are as follows:

    C:Program FilesMicrosoft Help Viewerv1.0HelpLibManager.exe  version is 1.0.40219.1, 259,416 bytes

    Event Log

    10/02/2013 11:06:05 PM


    Application: HelpLibManager.exe

    Framework Version: v4.0.30319

    Description: The process was terminated due to an unhandled exception.

    Exception Info: System.AccessViolationException


      at Microsoft.Help.Index.Indexer.MergeIndexAndLocations(System.Collections.Generic.Dictionary`2<System.String,Microsoft.Help.Index.ItemLocationEntry[]>, System.Collections.Generic.Dictionary`2<System.String,Microsoft.Help.Index.ItemLocationData>, Int32)

      at Microsoft.Help.Index.Indexer.MergeIndex(Microsoft.Help.Index.IndexReader, ….