public CompileHelper CompileTheCode( ITakeSample itakeSample, // pass this to executing code, which may not reference WPF asms string pathFileToExecute, CancellationToken token) { var compilerHelper = new CompileHelper(pathFileToExecute, _logger, itakeSample, token); try { compilerHelper.CompileTheCode(); } catch (Exception ex) { compilerHelper.CompileResults = ex.ToString(); } return(compilerHelper); }