[Mono-bugs] [Bug 81378][Nor] New - [OSX] WebRequest static constructor fails when invoked asynchronously

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Apr 14 15:06:35 EDT 2007


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 atsushi at ximian.com.

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

--- shadow/81378	2007-04-14 15:06:35.000000000 -0400
+++ shadow/81378.tmp.1215	2007-04-14 15:06:35.000000000 -0400
@@ -0,0 +1,111 @@
+Bug#: 81378
+Product: Mono: Class Libraries
+Version: 1.0
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: atsushi at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [OSX] WebRequest static constructor fails when invoked asynchronously
+
+using System;
+http://d.hatena.ne.jp/mayuki/20070414 reports that the following code fails
+to process WebRequest.cctor() under mono on OSX:
+
+using System.Net;
+using System.Threading;
+
+class Test {
+  public static void Main(String[] args)
+  {
+//    WebRequest.Create("http://www.google.com/");
+//    Console.WriteLine("WebReqeust.Create End.");
+    Thread t = new Thread(delegate(Object o) {
+      WebRequest webRequest = WebRequest.Create("http://www.google.com/");
+      Console.WriteLine("Thread: WebReqeust.Create End.");
+    });
+    t.Start();
+    t.Join();
+  }
+}
+
+Unhandled Exception: System.TypeInitializationException: An exception was
+thrown by the type initializer for System.Net.WebRequest --->
+System.ObjectDisposedException: The object was used after being disposed.
+  at System.IO.FileStream.Read (System.Byte[] dest, Int32 dest_offset,
+Int32 count) [0x00000] 
+  at System.Xml.XmlInputStream.Read (System.Byte[] buffer, Int32 offset,
+Int32 count) [0x00000] 
+  at System.Xml.NonBlockingStreamReader.ReadBuffer () [0x00000] 
+  at System.Xml.NonBlockingStreamReader.Read (System.Char[] dest_buffer,
+Int32 index, Int32 count) [0x00000] 
+  at Mono.Xml2.XmlTextReader.ReadTextReader (Int32 remained) [0x00000] 
+  at Mono.Xml2.XmlTextReader.PeekChar () [0x00000] 
+  at Mono.Xml2.XmlTextReader.ReadChar () [0x00000] 
+  at Mono.Xml2.XmlTextReader.ReadAttributeValueTokens (Int32
+dummyQuoteChar) [0x00000] 
+  at Mono.Xml2.XmlTextReader.ReadAttributes (Boolean isXmlDecl) [0x00000] 
+  at Mono.Xml2.XmlTextReader.ReadStartTag () [0x00000] 
+  at Mono.Xml2.XmlTextReader.ReadContent () [0x00000] 
+  at Mono.Xml2.XmlTextReader.Read () [0x00000] 
+  at System.Xml.XmlTextReader.Read () [0x00000] 
+  at System.Xml.XmlWriter.WriteNode (System.Xml.XmlReader reader, Boolean
+defattr) [0x00000] 
+  at System.Xml.XmlWriter.WriteNode (System.Xml.XmlReader reader, Boolean
+defattr) [0x00000] 
+  at System.Xml.XmlWriter.WriteNode (System.Xml.XmlReader reader, Boolean
+defattr) [0x00000] 
+  at System.Xml.XmlReader.ReadOuterXml () [0x00000] 
+  at System.Configuration.SectionInfo.ReadData
+(System.Configuration.Configuration config, System.Xml.XmlTextReader
+reader, Boolean overrideAllowed) [0x00000] 
+  at System.Configuration.SectionGroupInfo.ReadContent
+(System.Xml.XmlTextReader reader, System.Configuration.Configuration
+config, Boolean overrideAllowed, Boolean root) [0x00000] 
+  at System.Configuration.SectionGroupInfo.ReadRootData
+(System.Xml.XmlTextReader reader, System.Configuration.Configuration
+config, Boolean overrideAllowed) [0x00000] 
+  at System.Configuration.Configuration.ReadConfigFile
+(System.Xml.XmlTextReader reader, System.String fileName) [0x00000] 
+  at System.Configuration.Configuration.Load () [0x00000] 
+  at System.Configuration.Configuration.Init (IConfigSystem system,
+System.String configPath, System.Configuration.Configuration parent) [0x00000] 
+  at System.Configuration.Configuration..ctor
+(System.Configuration.InternalConfigurationSystem system, System.String
+locationSubPath) [0x00000] 
+  at System.Configuration.Configuration..ctor
+(System.Configuration.InternalConfigurationSystem system, System.String
+locationSubPath) [0x00000] 
+  at System.Configuration.Configuration..ctor
+(System.Configuration.InternalConfigurationSystem system, System.String
+locationSubPath) [0x00000] 
+  at System.Configuration.Configuration..ctor
+(System.Configuration.InternalConfigurationSystem system, System.String
+locationSubPath) [0x00000] 
+  at System.Configuration.InternalConfigurationFactory.Create (System.Type
+typeConfigHost, System.Object[] hostInitConfigurationParams) [0x00000] 
+  at System.Configuration.ConfigurationManager.OpenExeConfigurationInternal
+(ConfigurationUserLevel userLevel, System.Reflection.Assembly
+calling_assembly, System.String exePath) [0x00000] 
+  at
+System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection
+(System.String configKey) [0x00000] 
+  at System.Configuration.ConfigurationManager.GetSection (System.String
+sectionName) [0x00000] 
+  at System.Net.WebRequest..cctor () [0x00000] --- End of inner exception
+stack trace ---
+
+The exception above does not happen when the commented code is enabled
+(i.e. when no async call to WebRequest.cctor() happens).
+
+It seems to happen only on mac.
+
+Filed under class lib (System.dll), but is also likely the runtime issue.


More information about the mono-bugs mailing list