Difficulties porting uptime.NET to linux

Posted by Victor on May 10, 2002

Bummer! After #ifdefing out the Performance Counters, I successfully compile my classes… only to discover that in Mono, System.Environment is only stubbed, and its property OSVersion just returns null!!

Time to learn about PInvoke and implement it myself?

Update @01.43: Yet as I catched the NullReferenceException throwed by the incompleteness of Environment.OSVersion, I realize that Single.Parse(string) is unimplemented too :( I’ve been looking into the PInvoke thing. The difficult part, is to have it do different things on different platforms. The funny thing is, this would serve to know in which platform is being called… Once you know which code you should call (a PInvoke into a .dll or a .so), you don’t need it anymore! It’s kinda like an uncertainty principle mmmm does it ring any bells? why do I have the feeling I am overlooking something obvious?