[Mono-bugs] [Bug 533523] New: Mysterious bad string with System.Resources.ResXResourceWriter

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Aug 22 05:42:20 EDT 2009


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


           Summary: Mysterious bad string with
                    System.Resources.ResXResourceWriter
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: surfzoid2002 at yahoo.fr
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.13)
Gecko/2009080621 Mandriva/1.9.0.13-0.1mdv2009.1 (2009.1) Firefox/3.0.13

I have the following function to use System.Resources.ResXResourceWriter :

        public static void SaveRess(Dictionary<string, Font> ResXData, string
FsPath)

        {

            System.Resources.ResXResourceWriter test = new
System.Resources.ResXResourceWriter(FsPath);

            try

            {

                foreach (KeyValuePair<string, Font> item in ResXData)

                {

                    test.AddResource(new
System.Resources.ResXDataNode(item.Key.ToString(), item.Value));

                }

            }

            catch (Exception Ex)

            {

                Console.WriteLine("{0}{1}{1}{2}", Ex.Message,
Environment.NewLine, Ex.StackTrace);

            }

            test.Close();

        }

I'm using this function to save/restore the menu font of my application, like
that :


            if (fontDialog1.ShowDialog(this)== DialogResult.OK)

            {

                LblFontChoice.Font = fontDialog1.Font;

                Dictionary<string, Font> ToAdd = new Dictionary<string,
Font>();

                foreach (KeyValuePair<string, Font> item in ResXData)

                {

                    ToAdd.Add(item.Key.ToString(),fontDialog1.Font);

                }

                ResXData = ToAdd;

                LblFontChoice.Text = fontDialog1.Font.ToString();

                RessManager.SaveRess(ResXData, VarGlobale.SkinFontPath);
            }

Reproducible: Always

Steps to Reproduce:
By use the code below, save a first time the XML data, and the save it a second
time, this second time you will see extra data at the end of the file;
Normally it should end with "</data>
  </root>", but the second time it end with "</data>
  </root>a>
  </root>"
Actual Results:  
When the XML file is pollute, my application cannot start anymore and the stack
traces is very hard to understand for my End User.

Expected Results:  
no pollute data in the XML file, in any case !

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


More information about the mono-bugs mailing list