public async Task <ConsoleExecutionResult> RunAsync()
        {
            if (!this.isAssemblyGenerated)
            {
                throw new InvalidOperationException($@"Compilation is not available please invoke {nameof(this.Compile)} method and assert that compilation is successful.");
            }

            var totalExecutionTimmer = Stopwatch.StartNew();
            Task <ConsoleExecutionResult> resultTask = this.ExecuteInAssemblyInAppDomain();

            while (!resultTask.IsCompleted)
            {
                await Task.Delay(100);

                if (totalExecutionTimmer.ElapsedMilliseconds <= this.maxConsoleApplicationExecutionTimeMs)
                {
                    continue;
                }

                var result = new ConsoleExecutionResult()
                {
                    IsTimeouted = true
                };

                return(result);
            }

            return(resultTask.Result);
        }
        private Task <ConsoleExecutionResult> ExecuteInAssemblyInAppDomain()
        {
            return(Task.Run(() =>
            {
                var consoleExecutor = this.GetConsoleExecutor(this.appDomain);
                var consoleExecuteResult = new ConsoleExecutionResult();
                try
                {
                    var executionTimer = Stopwatch.StartNew();
                    consoleExecuteResult.ConsoleOutput = consoleExecutor.Execute();
                    consoleExecuteResult.ExecutionTimeMs = executionTimer.ElapsedMilliseconds;
                    consoleExecuteResult.Success = true;

                    return consoleExecuteResult;
                }
                catch (Exception ex)
                {
                    consoleExecuteResult.IsExceptionThrown = true;
                    consoleExecuteResult.Exception = ex.InnerException;

                    return consoleExecuteResult;
                }
            }));
        }