[Mono-bugs] [Bug 74841][Nor] New - Environment.OSVersion.Platform should return 4 (Unix) when running in the 2.0 profile

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 5 May 2005 15:55:41 -0400 (EDT)


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 gert.driesen@pandora.be.

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

--- shadow/74841	2005-05-05 15:55:41.000000000 -0400
+++ shadow/74841.tmp.30465	2005-05-05 15:55:41.000000000 -0400
@@ -0,0 +1,57 @@
+Bug#: 74841
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: gert.driesen@pandora.be               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Environment.OSVersion.Platform should return 4 (Unix) when running in the 2.0 profile
+
+When running Mono on Unix, Environment.OSVersion.Platform always returns 
+128.
+
+However, in .NET 2.0 MS added a Unix field to the System.PlatformID enum 
+with value 4. This field was also added in Mono, but 
+Environment.OSVersion.Platform still returns 128 when running on Unix.
+
+As a result, you get bad behaviour on Mono.
+
+Compile the following code on Mono using gmcs, and run it on Unix:
+
+using System;
+
+public class EntryPoint {
+	public static void Main() {
+		if (Environment.OSVersion.Platform == PlatformID.Unix) {
+			Console.WriteLine("Running on Unix");
+		} else {
+			Console.WriteLine("NOT running on Unix");
+		}
+	}
+}
+
+Actual Result:
+
+NOT running on Unix
+
+Expected Result:
+
+Running on Unix
+
+
+The ves_icall_System_Environment_get_Platform icall should be modified to 
+return 4 when running on Unix.
+
+Note: there's quite some code out there (even in the Mono class 
+libraries) that determines whether the current platform is unix by 
+checking if Environment.OSVersion.Platform is 128, so fixing this issue 
+might cause some regressions.