Sign in to follow this  

[.net] Detecting MS vs. Mono vs. DotGNU at runtime?

This topic is 4832 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there any way to check which version of the runtimes you're running on at runtime? Additionally, can you get information about the host OS and version, host processor, etc?

Share this post


Link to post
Share on other sites
Why do you need to know? The only difference in my game is the timer function, and I just see if QPC returns an exception and switch to a different timer method if it does. What other situations would you need to know your runtime for?

No offense; I'm just curious.

Share this post


Link to post
Share on other sites
I don't have any immediate examples, so I'll pull one from Java instead.

I was working on a Java game some time ago where we were using Java's native rendering functions in AWT. Now, the Mac OS X Quartz GUI system automatically double buffers all windows, but Windows doesn't. So when I added double buffering to the renderer, it caused quad buffering under Quartz and sliced our framerate in half on OSX. As a result, I needed to detect if I was running on an OSX system, and turn off double buffering if so.

Share this post


Link to post
Share on other sites
The operating system information, and other system information, can all be queried through various namespaces, like System.Management. However, it is best not to query which framework you are running on. There is no surefire way to get that, and it will tempt you to write code that is specific to a certain framework, thus making it harder to port, overall. Not to mention maintanence problems.

Share this post


Link to post
Share on other sites
The only time i think this would be useful is for gathering information when an error occured, for logging purposes

What is the safest way to attempt to query for framework information if I had to?

Share this post


Link to post
Share on other sites

This topic is 4832 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this