Registry.LocalMachine.OpenSubKey failing intermittently

netregistry

I have some code like so ( winforms app .NET 2.0 )
RegistryKey regKey=Registry.LocalMachine.OpenSubKey@"SOFTWARE\cPaperless\TTC\Settings", false);

This code is failing every once in a while on Win7 and Vista when UAC is on ( by failing i mean the key is null.) Note that the Key is definitely existing and I can see it in the registry
Furthermore another part of the product uses the same key in HKLM but that code is in C++ and that works every time
LONG lRetVal = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\cPaperless\TTC\Settings", 0, KEY_READ, &hKeyTTC_LM);

What could be going wrong here. Has anyone seen this behaviour before
TIA

Best Answer

Possible Registry Virtualization issue?

Related Topic