OpenSubKey return null though the key exist

G

Guest

Hi,

I'm trying to open this key
"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications", and
"HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache" but it
returns me null.

Anyone know why is that so?

Thanks in advance.
 
O

Oliver Sturm

Hello Han,

I'm using this code:

[TestFixture]
public class Tests {
[Test]
public void Test( ) {
OpenKeyAndCheck(Registry.LocalMachine, @"SOFTWARE\Classes\Applications");
OpenKeyAndCheck(Registry.CurrentUser,
@"Software\Microsoft\Windows\ShellNoRoam\MUICache");
}

private void OpenKeyAndCheck(RegistryKey key, string subKeyName) {
RegistryKey subKey = key.OpenSubKey(subKeyName);
Assert.IsNotNull(subKey);
}
}

I get the first test passed and the second failed - no wonder, the second
key doesn't exist on my machine. So what's the code you're using?


Oliver Sturm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top