[Mono-bugs] [Bug 322839] [PATCH] Unix: Incorrect RegistryKey.SetValue() Serialization

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Oct 14 04:06:51 EDT 2007


https://bugzilla.novell.com/show_bug.cgi?id=322839#c2


Gert Driesen <gert.driesen at pandora.be> changed:

           What    |Removed                                         |Added
----------------------------------------------------------------------------
                 CC|                                                |gert.driesen at pandora.be
         Depends on|                                                |333699
             Status|RESOLVED                                        |REOPENED
         Resolution|FIXED                                           |




--- Comment #2 from Gert Driesen <gert.driesen at pandora.be>  2007-10-14 02:06:49 MST ---
The fix does not work due to a bug in SecurityElement.FromString.

To reproduce, compile and run the following code snippet:

using System;
using Microsoft.Win32;

class Program
{
  static void Main ()
  {
    try {
      using (RegistryKey createdKey = Registry.CurrentUser.CreateSubKey
("bug322839")) {
        createdKey.SetValue ("Path", "/usr/lib/whatever");
        createdKey.SetValue ("Info", "<Great\"News\">!");
      }

      using (RegistryKey openedKey = Registry.CurrentUser.OpenSubKey
("bug322839")) {
        string path = openedKey.GetValue ("Path") as string;
        Console.WriteLine ("PATH=" + path);
        string info = openedKey.GetValue ("Info") as string;
        Console.WriteLine ("INFO=" + info);
      }
    } finally {
      Registry.CurrentUser.DeleteSubKeyTree ("bug322839");
    }
  }
}

Expected result:

PATH=/usr/lib/whatever
INFO=<Great"News">!

Actual result:

While loading registry key at
/home/gert/.mono/registry/CurrentUser/bug322839/values.xml:
System.Security.XmlSyntaxException: Invalid XML. ---> System.ArgumentException:
Invalid XML string: <Great"News">!
  at System.Security.SecurityElement.set_Text (System.String value) [0x00000] 
  at Mono.Xml.SecurityParser.OnChars (System.String ch) [0x00000] 
  at Mono.Xml.SmallXmlParser.HandleBufferedContent () [0x00000] 
  at Mono.Xml.SmallXmlParser.ReadContent () [0x00000] 
  at Mono.Xml.SmallXmlParser.Parse (System.IO.TextReader input, IContentHandler
handler) [0x00000] 
  at Mono.Xml.SecurityParser.LoadXml (System.String xml) [0x00000] 
  at System.Security.SecurityElement.FromString (System.String xml) [0x00000]
--- End of inner exception stack trace ---

  at System.Security.SecurityElement.FromString (System.String xml) [0x00000] 
  at Microsoft.Win32.KeyHandler.Load () [0x00000] 
PATH=
INFO=
While loading registry key at
/home/gert/.mono/registry/CurrentUser/bug322839/values.xml:
System.Security.XmlSyntaxException: Invalid XML. ---> System.ArgumentException:
Invalid XML string: <Great"News">!
  at System.Security.SecurityElement.set_Text (System.String value) [0x00000] 
  at Mono.Xml.SecurityParser.OnChars (System.String ch) [0x00000] 
  at Mono.Xml.SmallXmlParser.HandleBufferedContent () [0x00000] 
  at Mono.Xml.SmallXmlParser.ReadContent () [0x00000] 
  at Mono.Xml.SmallXmlParser.Parse (System.IO.TextReader input, IContentHandler
handler) [0x00000] 
  at Mono.Xml.SecurityParser.LoadXml (System.String xml) [0x00000] 
  at System.Security.SecurityElement.FromString (System.String xml) [0x00000]
--- End of inner exception stack trace ---

  at System.Security.SecurityElement.FromString (System.String xml) [0x00000] 
  at Microsoft.Win32.KeyHandler.Load () [0x00000] 
While loading registry key at
/home/gert/.mono/registry/CurrentUser/bug322839/values.xml:
System.Security.XmlSyntaxException: Invalid XML. ---> System.ArgumentException:
Invalid XML string: <Great"News">!
  at System.Security.SecurityElement.set_Text (System.String value) [0x00000] 
  at Mono.Xml.SecurityParser.OnChars (System.String ch) [0x00000] 
  at Mono.Xml.SmallXmlParser.HandleBufferedContent () [0x00000] 
  at Mono.Xml.SmallXmlParser.ReadContent () [0x00000] 
  at Mono.Xml.SmallXmlParser.Parse (System.IO.TextReader input, IContentHandler
handler) [0x00000] 
  at Mono.Xml.SecurityParser.LoadXml (System.String xml) [0x00000] 
  at System.Security.SecurityElement.FromString (System.String xml) [0x00000]
--- End of inner exception stack trace ---

  at System.Security.SecurityElement.FromString (System.String xml) [0x00000] 
  at Microsoft.Win32.KeyHandler.Load () [0x00000] 


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list