csharp registrykey is null

Code Example - csharp registrykey is null

                
                        // A 32-bit application on a 64-bit OS will be looking at 
// HKLM\Software\Wow6432Node node by default. 
// To read the 64-bit version of the key,
// you'll need to specify the RegistryView:

var hklm = RegistryKey.OpenBaseKey(
  RegistryHive.LocalMachine, RegistryView.Registry64));

var key = hklm.OpenSubKey(
  @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"));