I have a program that checks registry key for installed software. It was fine until recently it gets "Has stopped working" message when try to open. Seems caused by Windows updates.
Dim SoftwareKey As String = "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products"
Using rk As RegistryKey = Registry.LocalMachine.OpenSubKey(SoftwareKey)
For Each skName As String In rk.GetSubKeyNames
rk.GetSubKeyNames
returns NullReferenceExceptuon - Object reference not set to an instance of an object.
But the above code works fine If I target it as AnyCPU or X64. Not sure what caused this and why.