I have a RegistryKey as a Key for my dictionary.
I cannot seem to set a value for that specific Key. Whatever I do, I keep getting a KeyNotFoundE
CreateSubKey presumably returns a new object instance each time you call it. As such, calling it twice will give you different objects (even though they may refer to the same registry key). You should store the result of the first call to CreateSubKey instead of calling it again. Or use the key name instead of an object as your dictionary's key.