0

I have an application that compiles and debugs fine on a Win 7 (X86) machine. It installs and runs fine on a Windows 7 (X64) machine but if I try to debug after compiling I get an exception. Here is the code that throws the exception:

 public static string ReadLocalMachineRegistryKeyValue(string stringSubKey, string stringValue)
    {
        string stringReadValue = "";
        try
        {
            RegistryKey regKey;
            regKey = Registry.LocalMachine.OpenSubKey(stringSubKey);
            if (regKey != null)
            {
                stringReadValue = regKey.GetValue(stringValue).ToString();
            }
            else
            {
                throw new Exception("No such Subkey found.");
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        return stringReadValue;
    }

Any Idea why this will compile and run after installation but it will not debug on a 64 bit machine? It may be important to note that the value being assigned to the regKey variable is accurate when hovering over it. The regKey never picks up the value, it remains null.

willkk
  • 121
  • 3
  • 14

0 Answers0