//private SolutionState State; //private Task WriteStateAsync() //{ // return TaskDone.Done; //} //private Task ClearStateAsync() //{ // return TaskDone.Done; //} public override async Task OnActivateAsync() { //this.State = new SolutionState(); await StatsHelper.RegisterActivation("SolutionGrain", this.GrainFactory); Logger.OrleansLogger = this.GetLogger(); Logger.LogInfo(this.GetLogger(), "SolutionGrain", "OnActivate", "Enter"); this.projectsReadyCount = 0; //Task.Run(async () => //await Task.Factory.StartNew(async () => //{ try { if (!string.IsNullOrEmpty(this.State.SolutionPath)) { this.solutionManager = await OrleansSolutionManager.CreateFromSolutionAsync(this, this.GrainFactory, this.State.SolutionPath); } else if (!string.IsNullOrEmpty(this.State.Source)) { this.solutionManager = await OrleansSolutionManager.CreateFromSourceAsync(this, this.GrainFactory, this.State.Source); } else if (!string.IsNullOrEmpty(this.State.TestName)) { this.solutionManager = await OrleansSolutionManager.CreateFromTestAsync(this, this.GrainFactory, this.State.TestName); } //if (this.solutionManager != null) //{ // await this.WaitForAllProjects(); //} } catch (Exception ex) { var inner = ex; while (inner is AggregateException) { inner = inner.InnerException; } Logger.LogError(this.GetLogger(), "SolutionGrain", "OnActivate", "Error:\n{0}\nInner:\n{1}", ex, inner); throw ex; } //}); Logger.LogInfo(this.GetLogger(), "SolutionGrain", "OnActivate", "Exit"); }
public async Task SetSolutionPathAsync(string solutionPath) { await StatsHelper.RegisterMsg("SolutionGrain::SetSolutionPath", this.GrainFactory); Logger.LogInfo(this.GetLogger(), "SolutionGrain", "SetSolutionPath", "Enter"); this.State.SolutionPath = solutionPath; this.State.Source = null; this.State.TestName = null; await this.WriteStateAsync(); this.projectsReadyCount = 0; //Task.Run(async () => //await Task.Factory.StartNew(async () => //{ try { this.solutionManager = await OrleansSolutionManager.CreateFromSolutionAsync(this, this.GrainFactory, this.State.SolutionPath); //await this.WaitForAllProjects(); } catch (Exception ex) { var inner = ex; while (inner is AggregateException) { inner = inner.InnerException; } Logger.LogError(this.GetLogger(), "SolutionGrain", "SetSolutionPath", "Error:\n{0}\nInner:\n{1}", ex, inner); throw ex; } //}); Logger.LogInfo(this.GetLogger(), "SolutionGrain", "SetSolutionPath", "Exit"); }