Auto set the release stage

Set the release stage to dev if we are compiled with DEBUG on, or if the
debugger is attached - else default to production.
Oooohhhhh nice little bit of reflection there!

Its completely optimised out the line of code where the actual crash happened! Thats funny :D