Skip to content

Commit 88bbbfd

Browse files
Pass through joinable task factory
1 parent b44627f commit 88bbbfd

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

CommandLine/CodeConv.Shared/CodeConvProgram.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
using CodeConv.Shared.Util;
1515
using System.Reflection;
1616
using System.Diagnostics;
17+
using Microsoft.VisualStudio.Threading;
1718

1819
namespace ICSharpCode.CodeConverter.CommandLine
1920
{
@@ -134,7 +135,8 @@ private async Task ConvertAsync(IProgress<ConversionProgress> progress, Cancella
134135
}
135136

136137
var properties = ParsedProperties();
137-
var msbuildWorkspaceConverter = new MSBuildWorkspaceConverter(SolutionPath, CoreOnlyProjects, BestEffort, properties);
138+
var joinableTaskFactory = new JoinableTaskFactory(new JoinableTaskContext());
139+
var msbuildWorkspaceConverter = new MSBuildWorkspaceConverter(SolutionPath, CoreOnlyProjects, joinableTaskFactory, BestEffort, properties);
138140

139141
var converterResultsEnumerable = msbuildWorkspaceConverter.ConvertProjectsWhereAsync(ShouldIncludeProject, TargetLanguage, progress, cancellationToken);
140142
await ConversionResultWriter.WriteConvertedAsync(converterResultsEnumerable, SolutionPath, outputDirectory, Force, true, strProgress, cancellationToken);

CommandLine/CodeConv.Shared/MSBuildWorkspaceConverter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ public sealed class MSBuildWorkspaceConverter : IDisposable
3131
private AsyncLazy<Solution>? _cachedSolution; //Cached for performance of tests
3232
private readonly bool _isNetCore;
3333

34-
public MSBuildWorkspaceConverter(string solutionFilePath, bool isNetCore, bool bestEffortConversion = false, Dictionary<string, string>? buildProps = null)
34+
public MSBuildWorkspaceConverter(string solutionFilePath, bool isNetCore, JoinableTaskFactory joinableTaskFactory, bool bestEffortConversion = false, Dictionary<string, string>? buildProps = null)
3535
{
3636
_bestEffortConversion = bestEffortConversion;
3737
_buildProps = buildProps ?? new Dictionary<string, string>();
3838
_buildProps.TryAdd("Configuration", "Debug");
3939
_buildProps.TryAdd("Platform", "AnyCPU");
4040
_solutionFilePath = solutionFilePath;
4141
_isNetCore = isNetCore;
42-
_workspace = new AsyncLazy<MSBuildWorkspace>(() => CreateWorkspaceAsync(_buildProps));
42+
_workspace = new AsyncLazy<MSBuildWorkspace>(() => CreateWorkspaceAsync(_buildProps), joinableTaskFactory);
4343
}
4444

4545
public async IAsyncEnumerable<ConversionResult> ConvertProjectsWhereAsync(Func<Project, bool> shouldConvertProject, Language? targetLanguage, IProgress<ConversionProgress> progress, [EnumeratorCancellation] CancellationToken token)

Tests/TestRunners/MultiFileTestFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public sealed class MultiFileTestFixture : ICollectionFixture<MultiFileTestFixtu
4242
private static readonly string MultiFileCharacterizationDir = Path.Combine(TestConstants.GetTestDataDirectory(), "MultiFileCharacterization");
4343
private static readonly string OriginalSolutionDir = Path.Combine(MultiFileCharacterizationDir, "SourceFiles");
4444
private static readonly string SolutionFile = Path.Combine(OriginalSolutionDir, "CharacterizationTestSolution.sln");
45-
private static readonly MSBuildWorkspaceConverter _msBuildWorkspaceConverter = new MSBuildWorkspaceConverter(SolutionFile, false);
45+
private static readonly MSBuildWorkspaceConverter _msBuildWorkspaceConverter = new MSBuildWorkspaceConverter(SolutionFile, false, JoinableTaskFactorySingleton.EnsureInitialized());
4646

4747
public async Task ConvertProjectsWhereAsync(Func<Project, bool> shouldConvertProject, Language targetLanguage, [CallerMemberName] string expectedResultsDirectory = "")
4848
{

0 commit comments

Comments
 (0)