Skip to content

Commit 76fbc90

Browse files
committed
variable name change to be explicit that is a shared token
1 parent 29645b6 commit 76fbc90

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

SharedProject/Core/FCCEngine.cs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,11 @@ private CancellationTokenSource Reset()
149149
return cancellationTokenSource;
150150
}
151151

152-
private async System.Threading.Tasks.Task<string[]> RunCoverageAsync(List<ICoverageProject> coverageProjects,CancellationToken cancellationToken)
152+
private async System.Threading.Tasks.Task<string[]> RunCoverageAsync(List<ICoverageProject> coverageProjects,CancellationToken vsShutdownLinkedCancellationToken)
153153
{
154154
// process pipeline
155155

156-
await PrepareCoverageProjectsAsync(coverageProjects, cancellationToken);
156+
await PrepareCoverageProjectsAsync(coverageProjects, vsShutdownLinkedCancellationToken);
157157

158158
foreach (var coverageProject in coverageProjects)
159159
{
@@ -165,7 +165,7 @@ await coverageProject.StepAsync("Run Coverage Tool", async (project) =>
165165
var runCoverToolMessage = $"Run {coverageTool} ({project.ProjectName})";
166166
logger.Log(runCoverToolMessage);
167167
reportGeneratorUtil.LogCoverageProcess(runCoverToolMessage);
168-
await coverageUtilManager.RunCoverageAsync(project, cancellationToken);
168+
await coverageUtilManager.RunCoverageAsync(project, vsShutdownLinkedCancellationToken);
169169

170170
var duration = DateTime.Now - start;
171171
var durationMessage = $"Completed coverage for ({coverageProject.ProjectName}) : {duration}";
@@ -208,17 +208,17 @@ private void UpdateUI(List<CoverageLine> coverageLines, string reportHtml)
208208
RaiseUpdateOutputWindow(reportHtml);
209209
}
210210

211-
private async System.Threading.Tasks.Task<(List<CoverageLine> coverageLines,string reportFilePath)> RunAndProcessReportAsync(string[] coverOutputFiles, CancellationToken cancellationToken)
211+
private async System.Threading.Tasks.Task<(List<CoverageLine> coverageLines,string reportFilePath)> RunAndProcessReportAsync(string[] coverOutputFiles, CancellationToken vsShutdownLinkedCancellationToken)
212212
{
213213
var reportOutputFolder = coverageOutputManager.GetReportOutputFolder();
214-
cancellationToken.ThrowIfCancellationRequested();
215-
var result = await reportGeneratorUtil.GenerateAsync(coverOutputFiles,reportOutputFolder,cancellationToken);
214+
vsShutdownLinkedCancellationToken.ThrowIfCancellationRequested();
215+
var result = await reportGeneratorUtil.GenerateAsync(coverOutputFiles,reportOutputFolder,vsShutdownLinkedCancellationToken);
216216

217-
cancellationToken.ThrowIfCancellationRequested();
217+
vsShutdownLinkedCancellationToken.ThrowIfCancellationRequested();
218218
logger.Log("Processing cobertura");
219219
var coverageLines = coberturaUtil.ProcessCoberturaXml(result.UnifiedXmlFile);
220220

221-
cancellationToken.ThrowIfCancellationRequested();
221+
vsShutdownLinkedCancellationToken.ThrowIfCancellationRequested();
222222
logger.Log("Processing report");
223223
string processedReport = reportGeneratorUtil.ProcessUnifiedHtml(result.UnifiedHtml, reportOutputFolder);
224224
return (coverageLines, processedReport);
@@ -310,14 +310,14 @@ private async System.Threading.Tasks.Task PollInitializedStatusAsync(Cancellatio
310310

311311
public void RunAndProcessReport(string[] coberturaFiles, Action cleanUp = null)
312312
{
313-
RunCancellableCoverageTask(async (cancellationToken) =>
313+
RunCancellableCoverageTask(async (vsShutdownLinkedCancellationToken) =>
314314
{
315315
List<CoverageLine> coverageLines = null;
316316
string reportHtml = null;
317317

318318
if (coberturaFiles.Any())
319319
{
320-
(coverageLines, reportHtml) = await RunAndProcessReportAsync(coberturaFiles, cancellationToken);
320+
(coverageLines, reportHtml) = await RunAndProcessReportAsync(coberturaFiles, vsShutdownLinkedCancellationToken);
321321
}
322322
return (coverageLines, reportHtml);
323323
}, cleanUp);
@@ -326,44 +326,44 @@ public void RunAndProcessReport(string[] coberturaFiles, Action cleanUp = null)
326326
private void RunCancellableCoverageTask(
327327
Func<CancellationToken,System.Threading.Tasks.Task<(List<CoverageLine>, string)>> taskCreator, Action cleanUp)
328328
{
329-
var cts = Reset();
330-
var cancellationToken = cts.Token;
329+
var vsLinkedCancellationTokenSource = Reset();
330+
var vsShutdownLinkedCancellationToken = vsLinkedCancellationTokenSource.Token;
331331
disposeAwareTaskRunner.RunAsync(() =>
332332
{
333333
reloadCoverageTask = System.Threading.Tasks.Task.Run(async () =>
334334
{
335-
await PollInitializedStatusAsync(cancellationToken);
336-
var result = await taskCreator(cancellationToken);
335+
await PollInitializedStatusAsync(vsShutdownLinkedCancellationToken);
336+
var result = await taskCreator(vsShutdownLinkedCancellationToken);
337337
return result;
338338

339-
}, cancellationToken)
340-
.ContinueWith(DisplayCoverageResult, new DisplayCoverageResultState { CancellationTokenSource = cts, CleanUp = cleanUp}, System.Threading.Tasks.TaskScheduler.Default);
339+
}, vsShutdownLinkedCancellationToken)
340+
.ContinueWith(DisplayCoverageResult, new DisplayCoverageResultState { CancellationTokenSource = vsLinkedCancellationTokenSource, CleanUp = cleanUp}, System.Threading.Tasks.TaskScheduler.Default);
341341
return reloadCoverageTask;
342342
});
343343
}
344344

345345
public void ReloadCoverage(Func<System.Threading.Tasks.Task<List<ICoverageProject>>> coverageRequestCallback)
346346
{
347-
RunCancellableCoverageTask(async (cancellationToken) =>
347+
RunCancellableCoverageTask(async (vsShutdownLinkedCancellationToken) =>
348348
{
349349
List<CoverageLine> coverageLines = null;
350350
string reportHtml = null;
351351

352-
await PollInitializedStatusAsync(cancellationToken);
352+
await PollInitializedStatusAsync(vsShutdownLinkedCancellationToken);
353353

354354
reportGeneratorUtil.LogCoverageProcess("Starting coverage - full details in FCC Output Pane");
355355
LogReloadCoverageStatus(ReloadCoverageStatus.Start);
356356

357357
var coverageProjects = await coverageRequestCallback();
358-
cancellationToken.ThrowIfCancellationRequested();
358+
vsShutdownLinkedCancellationToken.ThrowIfCancellationRequested();
359359

360360
coverageOutputManager.SetProjectCoverageOutputFolder(coverageProjects);
361361

362362

363-
var coverOutputFiles = await RunCoverageAsync(coverageProjects, cancellationToken);
363+
var coverOutputFiles = await RunCoverageAsync(coverageProjects, vsShutdownLinkedCancellationToken);
364364
if (coverOutputFiles.Any())
365365
{
366-
(coverageLines, reportHtml) = await RunAndProcessReportAsync(coverOutputFiles, cancellationToken);
366+
(coverageLines, reportHtml) = await RunAndProcessReportAsync(coverOutputFiles, vsShutdownLinkedCancellationToken);
367367
}
368368

369369
return (coverageLines, reportHtml);

0 commit comments

Comments
 (0)