[Mono-bugs] [Bug 79182][Cri] Changed - [Patch] Localizable Forms -> ResourceSet is closed.

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Oct 7 09:13:35 EDT 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by alex.olk at googlemail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=79182

--- shadow/79182	2006-09-16 05:48:52.000000000 -0400
+++ shadow/79182.tmp.4396	2006-10-07 09:13:35.000000000 -0400
@@ -11,13 +11,13 @@
 AssignedTo: mono-bugs at ximian.com                            
 ReportedBy: dna at informatik.uni-kiel.de               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: 1_2
 URL: 
 Cc: 
-Summary: Localizable Forms -> ResourceSet is closed.
+Summary: [Patch] Localizable Forms -> ResourceSet is closed.
 
 I'm using the Linux Installer 1.1.16.1,
 
 following error occurs when trying to start a localizable MWF application:
 
 dna at dna-laptop:~$ mono ResourceTest.exe
@@ -85,6 +85,72 @@
 [...]
 ------------------
 
 So removing of "rset.Close ();" from
 System.Resources/ResourceSet.ApplyResources() solve the problem with
 the "System.InvalidOperationException: ResourceSet is closed." exception.
+
+------- Additional Comments From alex.olk at googlemail.com  2006-10-07 09:13 -------
+The problem here is, as Daniel wrote, that
+ComponentResourceManager.ApplyResources() closes the ResourceSet,
+which actually means that the ResourceSet gets disposed.
+
+Calling ApplyResources() multiple times returned a disposed
+ResourceSet in ResourceManager.InternalGetResourceSet and that caused
+the exception.
+
+So, here is a patch that fixes the problem:
+
+Index: System/System.ComponentModel/ComponentResourceManager.cs
+===================================================================
+--- System/System.ComponentModel/ComponentResourceManager.cs	(Revision
+66385)
++++ System/System.ComponentModel/ComponentResourceManager.cs
+(Arbeitskopie)
+@@ -71,7 +71,6 @@
+ 						pi.SetValue (value, Convert.ChangeType (di.Value,
+pi.PropertyType), null);
+ 				}
+ 			}
+-			rset.Close ();
+ 		}
+ 	}
+ }
+Index: corlib/System.Resources/ResourceSet.cs
+===================================================================
+--- corlib/System.Resources/ResourceSet.cs	(Revision 66385)
++++ corlib/System.Resources/ResourceSet.cs	(Arbeitskopie)
+@@ -48,6 +48,7 @@
+ 
+ 		protected IResourceReader Reader;
+ 		protected Hashtable Table;
++		internal bool isDisposed = false;
+ 
+ 		// Constructors
+ 		protected ResourceSet () {}
+@@ -102,6 +103,8 @@
+ 
+ 			Reader = null;
+ 			Table = null;
++			
++			isDisposed = true;
+ 		}
+ 
+ 		public virtual Type GetDefaultReader ()
+Index: corlib/System.Resources/ResourceManager.cs
+===================================================================
+--- corlib/System.Resources/ResourceManager.cs	(Revision 66385)
++++ corlib/System.Resources/ResourceManager.cs	(Arbeitskopie)
+@@ -290,8 +290,11 @@
+ 			}
+ 			/* if we already have this resource set, return it */
+ 			set=(ResourceSet)ResourceSets[culture];
+-			if(set!=null) {
++			if(set!=null && !set.isDisposed) {
+ 				return(set);
++			} else if (set!=null && set.isDisposed) {
++				ResourceSets.Remove (set);
++				set = null;
+ 			}
+ 
+ 			if(MainAssembly != null) {
+


More information about the mono-bugs mailing list