private static Delegate /*!*/ CompileDebug(LambdaExpression /*!*/ lambda) { // try to use PDBs and fallback to CustomGenerator if not allowed to: if (_HasPdbPermissions) { try { return(CompilerHelpers.CompileToMethod(lambda, DebugInfoGenerator.CreatePdbGenerator(), true)); } catch (SecurityException) { // do not attempt next time in this app-domain: _HasPdbPermissions = false; } } return(CompilerHelpers.CompileToMethod(lambda, new CustomGenerator(), false)); }