[Mono-dev] Wrong return value for RegistryKey.ToString(): Reason? or Can I fix?

Justin Cherniak justin.cherniak at gmail.com
Mon Feb 25 16:38:33 EST 2008


For some reason RegistryKey.ToString() on Mono does not produce the same
value as on .NET.  When running a program under windows, Mono returns the
keyname + a handle value when calling ToString().  Under .NET, it just
returns the keyname.  I looked through the source and the offending line
seems to be:
            IntPtr handle = GetHandle(rkey);
            return String.Format("{0} [0x{1:X}]", rkey.Name, handle.ToInt32
());

I'm just curious if there is a reason for this or if I can commit a fix.  I
think its worth noting that UnixRegistryApi returns the "proper" value, so
I'm unclear why the windows implementation would not.

Attached is a (albeit small) patch to correct the issue.

Thank you,
Justin Cherniak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080225/df410c40/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Win32RegistryApi.ToString.patch
Type: application/octet-stream
Size: 414 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080225/df410c40/attachment.obj 


More information about the Mono-devel-list mailing list