public IEnumerable <IDiagnostic> GetCompilationErrors(SourceCode post) { using (var stream = new MemoryStream()) { var result = compiler.Compile(post).Emit(stream); return(result.Diagnostics); } }
public ExecutionResult Execute(SourceCode sourceCode, TimeSpan timeout) { var compilation = compiler.Compile(sourceCode); byte[] compiledAssembly; using (var stream = new MemoryStream()) { var emitResult = compilation.Emit(stream); if (!emitResult.Success) { return(new ExecutionResult { Result = "[Compilation failed]" }); } compiledAssembly = stream.ToArray(); } var sandbox = new Sandbox(compiledAssembly); return(sandbox.Run("EntryPoint", "Result", timeout)); }
public ExecutionResult Execute(Post post) { var compilation = compiler.Compile(post); byte[] compiledAssembly; using (var stream = new MemoryStream()) { var emitResult = compilation.Emit(stream); if (!emitResult.Success) { return(new ExecutionResult { Result = "[Compilation failed]" }); } compiledAssembly = stream.ToArray(); } using (var sandbox = new Sandbox(compiledAssembly)) { return(sandbox.Run("EntryPoint", "Result", TimeSpan.FromSeconds(5))); } }
public IEnumerable <IDiagnostic> GetCompilationErrors(Post post) { var result = compiler.Compile(post).Emit(); return(result.Diagnostics); }