Bug 395 - [PATCH] When localized, null reference exception in TableLayoutPanel.ColumnStyles.Clear() / RowSyles.Clear()
Summary: [PATCH] When localized, null reference exception in TableLayoutPanel.ColumnSt...
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: Windows.Forms ()
Version: 2.10.x
Hardware: PC All
: --- normal
Target Milestone: Untriaged
Assignee: Thomas Goldstein
URL:
Depends on:
Blocks:
 
Reported: 2011-08-25 05:35 UTC by chriss-79
Modified: 2011-11-28 14:00 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test case (24.02 KB, application/x-zip-compressed)
2011-09-01 16:51 UTC, Thomas Goldstein
Details
patch that fixes crash. (1.45 KB, patch)
2011-10-17 08:10 UTC, Tom Hindle
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description chriss-79 2011-08-25 05:35:11 UTC
Description of Problem:
When using .net localization, a call to TableLayoutPanel.ColumnStyles.Clear() or TableLayoutPanel.RowSyles.Clear() raises 

System.NullReferenceException: Object reference not set to an 
 instance of an object
     at System.Windows.Forms.TableLayoutStyleCollection.Clear () 
 [0x00000] in <filename unknown>:0
     at Test_TableLayoutPanel.Form1.button1_Click (System.Object sender, 
 System.EventArgs e) [0x00000] in <filename unknown>:0


Steps to reproduce the problem:
1. Create a new windows application project in Visual Studio (I tested only
with .net 2)
2. Add a TableLayoutPanel to the form
3. Add a button that calls tableLayoutPanel1.ColumnStyles.Clear()
4. Enable Localizable property of Form
5. Compile in Visual Studio


Actual Results:
  When clicking the button the above exception is raised.

Expected Results:
  Same behavior like without localization enabled: No exception.

How often does this happen? 
  Always (when localized)

Additional Information:
  No need to actually add a second language - the behavior can be seen after setting Localizable to true.

Tested with following envorinments:
- Windows 7 32 bit / Mono 2.20.4
- Linux Ubuntu 10.04 32 bit / Mono 2.4.4
- Linux Ubuntu 11.10 alpha 32 bit / Mono 2.10.3
Comment 1 Thomas Goldstein 2011-09-01 16:51:52 UTC
Created attachment 234 [details]
Test case

Please attach a test case next times.
Comment 2 Tom Hindle 2011-10-17 08:10:48 UTC
Created attachment 710 [details]
patch that fixes crash.
Comment 3 Tom Hindle 2011-10-17 08:12:13 UTC
Please review.
Comment 4 Thomas Goldstein 2011-11-25 17:41:44 UTC
Nit: shouldn't it be an ArgumentNullException?
Otherwise, looks good to me, please commit.
Comment 5 Tom Hindle 2011-11-28 12:57:06 UTC
Thanks for the review.

done commits b8fb0fe96fe3fccdb3a3f40defc89b04c43bc4d9 in b67c792ec351d47fe354764ca349220faaefa374 

Sorry for the two commits :(
Comment 6 Thomas Goldstein 2011-11-28 14:00:31 UTC
Thanks. And sorry it took me so long to check out your patch (missed the notification mail somehow).

Marking as fixed.