Skip to content

Commit

Permalink
Update to use Task.Run to force run outside the Revit context
Browse files Browse the repository at this point in the history
  • Loading branch information
ricaun committed Dec 9, 2024
1 parent bbcb6d4 commit ae98581
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Update `Log` file name.
- Update `ricaun.NUnit` to `1.4.1`.
- Add `MetadataMapper` to map `AssemblyMetadata` configuration.
- Update to use `Task.Run` to force run outside the Revit context.
### TestAdapter
- Update `MapperKey` to multiple converts.
- Update `MetadataMapper` with `prefix`.
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>1.7.1-alpha.2</Version>
<Version>1.7.1-alpha.3</Version>
</PropertyGroup>
</Project>
3 changes: 2 additions & 1 deletion ricaun.RevitTest.Application/Revit/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ private static void PipeTestServer_Initialize()

try
{
testAssemblyModel = await TestExecuteUtils.ExecuteAsync(RevitTask, message.TestPathFile, RevitParameters.Parameters);
testAssemblyModel = await Task.Run(() => TestExecuteUtils.ExecuteAsync(RevitTask, message.TestPathFile, RevitParameters.Parameters));
//testAssemblyModel = await TestExecuteUtils.ExecuteAsync(RevitTask, message.TestPathFile, RevitParameters.Parameters);
}
catch (Exception ex)
{
Expand Down
5 changes: 2 additions & 3 deletions ricaun.RevitTest.Application/Revit/Utils/TestExecuteUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ public static async Task<TestAssemblyModel> ExecuteAsync(IRevitTask revitTask, s
throw new Exception("Extract Zip Fail");
}

//TestAssemblyModel tests = await revitTask.Run(() => TestDirectory(zipDestination, parameters));
TestAssemblyModel tests = await TestDirectoryAsync(revitTask, zipDestination, Path.GetFileName(filePath), parameters);
TestAssemblyModel tests = await Task.Run(() => TestDirectoryAsync(revitTask, zipDestination, Path.GetFileName(filePath), parameters));

await revitTask.Run(() => CopyFilesBackUsingZip(filePath, zipDestination));

Expand Down Expand Up @@ -137,7 +136,7 @@ private static async Task<TestAssemblyModel> TestDirectoryAsync(IRevitTask revit
Log.WriteLine($"Tasks: [{string.Join(",", testAsyncNames)}]");
TestEngineFilter.TestNames.Clear();
TestEngineFilter.TestNames.AddRange(testAsyncNames);
var modelTestAsync = TestEngine.TestAssembly(filePath, parameters);
var modelTestAsync = await Task.Run(() => TestEngine.TestAssembly(filePath, parameters));
if (modelTest is null) modelTest = modelTestAsync;
else
{
Expand Down

0 comments on commit ae98581

Please sign in to comment.