[Mono-dev] System.PlatformID

Nicholas Salerno nsalerno at securewatch24.com
Mon Sep 20 18:06:06 EDT 2010

Hello.  Looking for some enlightenment on System.PlatformID.

When I query System.Environment.OSVersion.Platform on Linux I get a value that will equate to 128.  Yet, this is not in the source code definition for the PlatformID enum.  I can guess at this part, Mono can't add names to an enum that Microsoft controls, say if Microsoft decided to extend the enum.

Question: is 128 supposed to mean Linux?

So, I am trying to do a switch on OSVersion.Platform and it is not working.  Looking through the Mono source code I see this piece:

int p = (int) Environment.OSVersion.Platform;

if (p == 4 || p == 128 || p == 6){

I'll do this instead (if that is what it takes, although I will use a constant for 128 rather than the number itself).  I am wondering if there is a better way or if this is all that can be done.

Also, what if Microsoft suddenly came out of nowhere and said that 128 will map to AIX?  Was 128 chosen because there are far less than a 100 platforms worth caring about?


More information about the Mono-devel-list mailing list