Bugzilla – Bug 316240
race condition using IFormatProvider.GetFormat
Last modified: 2007-09-15 21:24:46 UTC
---- Reported by gert.driesen@pandora.be 2004-10-14 08:54:30 MST ---- There seems to be a race condition when using IFormatProvider.GetFormat in a both the default and a newly constructed appdomain. In the separate appdomain, the call to IFormatProvider.GetFormat seems to return null. I've attached a small repro. Just build it using : $ mcs -r:System.Web.dll test.cs and run it $ mono test.exe and you'll get the following exception : Unhandled Exception: System.FormatException: Error parsing 442px Server stack trace: in <0x003f7> System.Web.UI.WebControls.Unit:.ctor (string,System.Globalization.CultureInfo,System.Web.UI.WebControls.UnitTyp e) in <0x00012> System.Web.UI.WebControls.Unit:.ctor (string,System.Globalization.CultureInfo) in <0x00025> System.Web.UI.WebControls.Unit:Parse (string,System.Globalization.CultureInfo) in <0x000dd> System.Web.UI.WebControls.UnitConverter:ConvertFrom (System.ComponentModel.ITypeDescriptorContext,System.Globalization.Culture Info,object) in <0x00022> System.ComponentModel.TypeConverter:ConvertFrom (object) in <0x00026> Descriptor:Test () in <0xc6b3dc6d> (wrapper managed-to-native) System.Runtime.Remoting.RemotingServices:InternalExecute (System.Reflection.MethodBase,object,object[],object[]&) in <0x00004> (wrapper managed-to-native) System.Runtime.Remoting.RemotingServices:InternalExecute (System.Reflection.MethodBase,object,object[],object[]&) in <0x0018f> System.Runtime.Remoting.RemotingServices:InternalExecuteMessage (System.MarshalByRefObject,System.Runtime.Remoting.Messaging.IMethodCallMe ssage) Exception rethrown at [0]: ---> System.NullReferenceException: Object reference not set to an instance of an object in <0x0001d> System.Int32:FindSign (int&,string,System.Globalization.NumberFormatInfo,bool&,bool&) in <0x003ec> System.Int32:Parse (string,System.Globalization.NumberStyles,System.IFormatProvider,bool,int& ) in <0x00021> System.Int32:Parse (string,System.Globalization.NumberStyles,System.IFormatProvider) in <0x00010> System.Int32:Parse (string,System.IFormatProvider) in <0x00360> System.Web.UI.WebControls.Unit:.ctor (string,System.Globalization.CultureInfo,System.Web.UI.WebControls.UnitTyp e) --- End of inner exception stack trace --- in <0xc6adc2f7> (wrapper remoting-invoke) Descriptor:Test () in <0x00004> (wrapper remoting-invoke) Descriptor:Test () in <0x0002c> (wrapper remoting-invoke-with-check) Descriptor:Test () in <0x0021b> EntryPoint:Main () ---- Additional Comments From gert.driesen@pandora.be 2004-10-14 08:57:22 MST ---- Created an attachment (id=166916) (gzipped) tar archive containing repro ---- Additional Comments From vargaz@gmail.com 2004-10-14 10:46:59 MST ---- Created an attachment (id=166917) simpler testcase ---- Additional Comments From vargaz@gmail.com 2004-10-14 10:58:56 MST ---- This is because Thread.CurrentCulture returns a culture object which resides in the original appdomain, not in the appdomain of the caller. So this is a dup of #50049. ---- Additional Comments From vargaz@gmail.com 2004-10-22 00:30:17 MST ---- *** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO50049 *** Imported an attachment (id=166916) Imported an attachment (id=166917) This bug was marked DUPLICATE in the database it was moved from. Changing resolution to "MOVED"