[Mono-bugs] [Bug 28300][Nor] New - NullReferenceException on two members of System.Environment

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
29 Jul 2002 07:58:37 -0000


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 zer@neo.rr.com.

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

--- shadow/28300	Mon Jul 29 03:58:37 2002
+++ shadow/28300.tmp.18976	Mon Jul 29 03:58:37 2002
@@ -0,0 +1,71 @@
+Bug#: 28300
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: Windows XP
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: zer@neo.rr.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: NullReferenceException on two members of System.Environment
+
+Description of Problem:
+
+Two members of System.Environment, one of which my nice happy fun IRC 
+class library relies on, give NullReferenceExceptions when my application 
+attempts to access them. :-(
+
+To reproduce the problem:
+
+namespace Test1
+{
+	class Class1
+	{
+		static void Main(string[] args)
+		{
+			Console.WriteLine
+(Environment.SystemDirectory.ToString());
+			Console.WriteLine(Environment.OSVersion.ToString
+());
+		}
+	}
+}
+
+Both of these members cause this error. :-(
+
+Actual Results:
+
+For the code that produces this error,
+
+(process:1960): ** WARNING **: unhandled exception 
+System.NullReferenceException
+: "A null value was found where an object instance was required"
+#0: 0x00014 callvirt   in Test1.Class1::Main ([00C26F60] )
+
+(using mint -- similar error using mono) I'm guessing the static 
+Environment constructor is just missing initialization for these. :-)
+
+Expected Results:
+
+I was expecting my test console IRC client to happily use the library and 
+connect. ;-) Well, this sample program I was expecting to print out two 
+lines and exit. Ah well. :-)
+
+How often does this happen? 
+
+Every time.
+
+Additional information:
+
+If you need to take a look at the source for the original thing giving 
+the bug, you can pick it up at http://www.illusorystudios.com/coding/. 
+The console IRC client is at the 'Sample Code' link. Either way, at least 
+using Microsoft's C# compiler the above code gives an error. I haven't 
+tried mcs. VS.NET IDE is too precious to me. :-)