fixed some building errors and warnings in Mono
improved the code to make sure the AppDomainAppServer can work correctly in the case Mono doesn't support AppDomain monitoring