Microsoft.Win32.RegistryKey reg; reg = Microsoft.Win32.Registry.LocalMachine.CreateSubKey("EDIT"); 

An unhandled exception of type "System.IO.IOException" in mscorlib.dll

Additional Information: The parameter is set incorrectly.

Unhandled exception: System.IO.IOException: The parameter is set incorrectly.

in the Microsoft.Win32.RegistryKey.Win32Error (Int32 errorCode, String str) in the Microsoft.Win32.RegistryKey.CreateSubKeyInternal (String subkey, RegistryKeyPermissionCheck permissionCheck, Object registrySecurityObj, RegistryOptions registryOptions in the service of the company in the Windows ) in Microsoft.Win32.RegistryKey.CreateSubKey (String subkey) in TrasherForWindows10.Reg.CreatePartHKLM (String name_part) in Z: \ xxx \ projectvisualstudio2016 \ TrasherForWindows10 \ TrasherForWindows10 \ Reg.cs: line 41 in TrashrWFor108 / Reg.cs: TrashrForWindows10 \ TrasherForWindows10 \ Reg. ] args) in Z: \ xxx \ projectvisualstudio2016 \ TrasherForWindows10 \ TrasherForWindows10 \ Program.cs: line 15

Normally only subkey keys are created.

 reg = Microsoft.Win32.Registry.LocalMachine.CreateSubKey("Software\\EDIT");\ 

Need to do as here enter image description here

Added by

System.IO.IOException not processed HResult = 87 Message = The parameter is set incorrectly.

Source = mscorlib StackTrace: in Microsoft.Win32.RegistryKey.Win32Error (Int32 errorCode, String str) in Microsoft.Win32.RegistryKey.CreateSubKeyInternal (String subkey, RegistryKeyPermissionCheck permissionCheck, AdministrativeSecurityObj, ourIran, ourIran, ourIs, ourIran, ourKey32, RegistryKeyPermissionCheck permissionCheck String subkey, RegistryKeyPermissionCheck permissionCheck) in Microsoft.Win32.RegistryKey.CreateSubKey (String subkey) in TrasherForWindows10.Reg. .Main (String [] args) in Z: \ xxx \ projectvisualstudio2016 \ TrasherForWindows10 \ TrasherForWindows10 \ Program.cs: line 15 InnerException: enter image description here enter image description here

  • one
    Maybe not enough rights, try out from under the admin. It would be good to see the text of the exception. - αλεχολυτ
  • admin doesn't help - codename0082016
  • Well, what about the 'Message' exceptions? - αλεχολυτ
  • The machine is not in the domain? Home PC? - isnullxbh
  • home ....... - codename0082016

1 answer 1

Open MSDN, look for the RegistryKey.CreateSubKey function, scroll to the Exceptions section, find our IOException , and read the condition under which it occurs:

The nesting level exceeds 510.

-or-

There is a system error occurred, such as deletion of the key.

Humble, so creating your subkey in HKLM is not allowed.