Bug: Excel add-in using .NET leaks some registry handles due to ClickToRun

New Contributor

I am not sure what is the best way to report this issue. It is low level technical. If someone knows of a better way to report this to Microsoft, please let me know.


We have written av Excel add-in that uses .NET Framework (4.8).

It polls our our backend for updates every now and then.

We have noticed that there is a leak of open handles to the registry and that it grows over time.

This does not always happen and it took some effort to understand where this leak comes from.


It turned out that this only happens if Excel is installed via ClickToRun and it is related to registry virtualization.

This is what we have found:

  • As a part of setting up the HTTP communication, .NET will attempt to use a proxy server. It looks for registry settings to see if any proxy server is configured.
  • Regardless if a proxy server is configured or not, .NET starts to monitor a registry key mentioned using RegNotifyChangeKeyValue: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings
  • ClickToRun virtulizes this part of the registry and it is redirected to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\REGISTRY\MACHINE\Software\Microsoft\Windows\CurrentVersion\Internet Settings
  • This virtualization does not work well with how .NET uses RegNotifyChangeKeyValue to listen for changes. Each time the session is set up a handle to the registry will be leaked.
  • There is no leak if Excel is not installed via ClickToRun or if virtualization for the mentioned registry key is turned off by adding this path to PassThroughPaths   in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\REGISTRY\MACHINE\Software\Microsoft\AppV\Subsystem\VirtualRegistry

This is cleary a bug/incompatibility in ClickToRun when using .NET Framework.


What you see as leaked handles in ProcessMonitor are a lot of handles to 

\REGISTRY\MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\REGISTRY\MACHINE\Software\Microsoft\Windows\CurrentVersion\Internet Settings

I don't know how to best report this to Microsoft.

2 Replies
You could report this from within Excel using Help, Feedback, I don't like something.
It is already reported using the feedback function in Excel.