[Mono-list] Nothing happens with mono-service and EventLog.WriteEntry

Michael Schurter michael at susens-schurter.com
Thu Feb 15 13:02:34 EST 2007


On Thu, 2007-02-15 at 12:29 -0500, Will Murnane wrote:
> On 2/15/07, Robert Jordan <robertj at gmx.net> wrote:
> > This test is not valid because future OS platforms (say
> > Win64<InsertCoolNameHere>) would be mapped to Unix.
> Sure, but neither is the other test future-compatible.  Suppose you're
> on a platform that isn't 4 or 128 but isn't MS Windows?  It's safer to
> only do Windows things only when you're sure you're on Windows.  If
> new platforms are added, you need to handle them, whether you do
> something special in their case or not.  I'd tend to write a
> switch/case statement, handle all cases, and have the default throw an
> exception.  That way when new platforms come out you remember to
> update the case statement.  After all, who knows if the existing code
> will suffice for the new platform!

Different applications require different OS detection patterns.  Since
EventLog is implemented in Mono, I don't really mind if its used even on
non-Windows platforms.  For my app throwing an exception for an
unhandled OS would be the *wrong* thing to do.

So perhaps the FAQ could stand to mention that other methods may be more
robust, but there's never going to be 1 "best" solution.



More information about the Mono-list mailing list