[Mono-bugs] [Bug 582440] New: ResXResourceReader does not read resource comments.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Feb 23 16:39:57 EST 2010


http://bugzilla.novell.com/show_bug.cgi?id=582440

http://bugzilla.novell.com/show_bug.cgi?id=582440#c0


           Summary: ResXResourceReader does not read resource comments.
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: kuritsu at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=344240)
 --> (http://bugzilla.novell.com/attachment.cgi?id=344240)
This a Mono project with the test case.

User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; es-MX; rv:1.9.1.5)
Gecko/20091109 Ubuntu/9.10 (karmic) Firefox/3.5.5

When I create an instance of the ResXResourceReader class, and try to read a
resx file with comments in the resources, I obtain no comments in the resulting
instances of ResXDataNode given by the GetEnumerator method of
ResXResourceReader when the property UseResXDataNodes = true.


Reproducible: Always

Steps to Reproduce:
1. Create a C# console application in MonoDevelop and add System.Windows.Forms
as reference.
2. Add System.Resources in the usings section.
3. In the Main method of the main class, put the following code:

ResXResourceReader reader = new ResXResourceReader("Resources.resx");
reader.UseResXDataNodes = true;
ResXDataNode node;
foreach (DictionaryEntry entry in reader)
{
    node = (ResXDataNode)entry.Value;
    Console.WriteLine(String.Format("{0} = {1} ({2})", node.Name,
node.GetValue(new AssemblyName[0]), node.Comment));
}
reader.Close();

4. Create a resx file and put some comments in it, like this:

<?xml version="1.0" encoding="utf-8"?><root>
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0"
msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0"
msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1"
/>
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3"
/>
              <xsd:attribute name="mimetype" type="xsd:string"
msdata:Ordinal="4" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0"
msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
<resheader name="resmimetype"><value>text/microsoft-resx</value></resheader>
<resheader name="version"><value>1.3</value></resheader>
<resheader name="reader"><value>System.Resources.ResXResourceReader,
System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089</value></resheader><resheader
name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089</value></resheader>
<data name="key1"><value>value1</value><comment>comment1</comment></data>
  <data name="key2"><value>value2</value><comment>comment2</comment></data>
  <data name="key3"><value>value3</value><comment>comment3</comment></data>
  </root>

5. Run the project and check the output.
Actual Results:  
The console writes the following:

key1 = value1 ()
key2 = value2 ()
key3 = value3 ()

No comments!

Expected Results:  
This is what the console should display:

key1 = value1 (comment1)
key2 = value2 (comment2)
key3 = value3 (comment3)

-- 
Configure bugmail: http://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