[Mono-dev] RegistryKey.OpenSubKey behavior

Rafael Teixeira monoman at gmail.com
Mon Jan 27 11:33:41 UTC 2014


Pull requests are preferred! :)
Unit tests are a must!

Thanks,

Rafael Teixeira
O..:.)oooo


On Sat, Jan 25, 2014 at 3:32 PM, Juan Cristóbal Olivares <
cristobal at cxsoftware.com> wrote:

> Hi guys:
>
> I was working with a third party library and got this exception:
>
> Unhandled Exception:
> System.Security.SecurityException: No access to the given key (see
> stacktrace [1]).
>
> This exception is thrown when calling
>
> Microsoft.Win32.RegistryKey.OpenSubKey (string name, bool writable)
>
> with the second parameter = true.
>
> This is a minimum example (see full code [2]):
>
> var localMachine = Registry.LocalMachine;
> Console.WriteLine (localMachine);
> var test = localMachine.OpenSubKey("ThisIsATest", true);
> Console.WriteLine("Test key: {0}", test);
> if (test != null)
>         test.Close();
> localMachine.Close();
>
> According to the documentation [3], "If the requested key does not exist,
> this method returns null instead of throwing an exception.".
>
> I tested this on Windows (.Net Framework 4) and works as expected -returns
> null instead of an exception-.
>
> Let me know what do you think.
>
> I could fix this if you want. I'm not sure how to proceed. I have not
> contributed for a while :) Should I send a patch or a pull request? Please
> let me know!
>
> Regrads,
> JCO
>
> References:
> [1] http://pastebin.com/P4uHntLK
> [2] http://pastebin.com/vrRfpF4P
> [3] http://msdn.microsoft.com/en-us/library/xthy8s8d%28v=vs.110%29.aspx
>
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20140127/0b4c4f87/attachment.html>


More information about the Mono-devel-list mailing list