private void CompileAndRun(DataContextInfo dcInfo) { try { object obj2; QueryCore core; lock ((obj2 = this._locker)) { core = this._query; if ((core == null) || this._cancelRequest) { return; } } if ((dcInfo != null) && (dcInfo.Error != null)) { this.OnQueryCompleted("Connection error", dcInfo.Error); } else { DataContextDriver driver = core.GetDriver(true); if ((driver != null) && (driver.AssembliesToAddError != null)) { this.OnQueryCompleted("Error loading custom driver assemblies", driver.AssembliesToAddError.Message); } else { QueryCompiler c = null; if (((this._lastCompilation != null) && (this._lastCompilation.AssemblyDLL != null)) && File.Exists(this._lastCompilation.AssemblyDLL.FullPath)) { c = this._lastCompilation.Compiler; if (!((((dcInfo != null) || (this._lastCompilation.DataContextDLL == null)) && ((dcInfo == null) || (this._lastCompilation.DataContextDLL != null))) ? (((dcInfo == null) || (this._lastCompilation.DataContextDLL == null)) || (dcInfo.AssemblyPath == this._lastCompilation.DataContextDLL)) : false)) { c = null; } } bool flag2 = false; if (c == null) { this._executionProgress = LINQPad.ExecutionModel.ExecutionProgress.Compiling; c = QueryCompiler.Create(core, true); lock ((obj2 = this._locker)) { if (this._cancelRequest) { return; } } c.Compile(this._source, core, (dcInfo == null) ? null : dcInfo.AssemblyPath); lock ((obj2 = this._locker)) { if (this._cancelRequest) { return; } if (c.Errors.HasErrors) { this._executionProgress = LINQPad.ExecutionModel.ExecutionProgress.Finished; this.QueryCompleted = null; this.PluginsReady = null; this.CustomClickComplete = null; } } this.OnQueryCompiled(new QueryCompilationEventArgs(c, (dcInfo == null) ? null : dcInfo.AssemblyPath, this._partialSource)); flag2 = true; } lock ((obj2 = this._locker)) { if ((this._cancelRequest || c.Errors.HasErrors) || this._compileOnly) { this._executionProgress = LINQPad.ExecutionModel.ExecutionProgress.Finished; return; } } Server server = this._serverGenerator(this); if (server != null) { lock ((obj2 = this._locker)) { if (this._cancelRequest) { return; } if (this._server != server) { this.ClearServer(); } this._server = server; this._executionProgress = LINQPad.ExecutionModel.ExecutionProgress.Executing; } bool flag7 = c.References.Any <string>(r => r.EndsWith(".winmd", StringComparison.InvariantCultureIgnoreCase)); server.WriteResultsToGrids = core.ToDataGrids; server.ExecuteClrQuery(this, core.Repository, c.OutputFile.FullPath, c.LineOffset, c.References.ToArray <string>(), Program.MTAMode || flag7, flag2 && c.Errors.HasWarnings, core.FilePath, core.Name, this._pluginWinManager, !UserOptionsLive.Instance.ExecutionTrackingDisabled); } } } } catch (Exception exception) { try { this.OnQueryCompleted("Unable to execute query", ""); } catch { } Program.ProcessException(exception); } }
public QueryCompilationEventArgs(QueryCompiler c, TempFileRef dataContextDLL, bool partialSource) { this.Compiler = c; this.DataContextDLL = dataContextDLL; this.PartialSource = partialSource; }