none
ResXResourceReader problem

    Question

  • Hi,

    A bug in ResXResourceReader?

    ResXResourceReader throws an exception when accessing the .resx file of a form including a menustrip which has menuitems with shortcuts having the Ctrl modifier.

    I created a sample c# program ins VS2008 with just one form (Form1), I added a menustrip then I "inserted the standard items". If I set the Localizable property to TRUE the reasulting Form1.resx cannot be read using the ResXReader class. If I change all the "Ctrl+..." shortcut to "Alt+..." it works. Anyway the sample programs compiles and runs.

    In VS2010 I have the same behaviour but worse the Form1 doesn't compile anymore and the compiler returns an error very similar to the one I got using the .resx file.

    Thanks for any help,

    Fabrizio

     

    Wednesday, September 29, 2010 11:39 AM

All replies

  • Hello ngutuparore,

    I have tried your steps and it works all right, no matter which Modifiers used in ShortCutKeys (ctrl or Alt) both works fine, if you still puzzled with the problem, would you please post your code here to help us track this out?

    Following is the code that I used for a test:

            private void button1_Click(object sender, EventArgs e)

            {

                ResXResourceReader rsxr = new ResXResourceReader(@"E:\ResXResourceReaderBug\ResXResourceReaderBug\Form1.resx");

     

                // Iterate through the resources and display the contents to the console.

                foreach (DictionaryEntry d in rsxr)

                {

                    MessageBox.Show(d.Key.ToString() + ":\t" + d.Value.ToString());

                }

     

                //Close the reader.

                rsxr.Close();

            }

    Hope this helps.

    Best wishes,
    Helen Zhou 

    If you confirm that the click event acts all right in .NET1.0, but failed in .NET3.5, you may post a bug on the bug site http://connect.microsoft.com/VisualStudio , and then post the link back here.


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Thursday, September 30, 2010 2:26 AM