diff --git a/CHANGELOG.md b/CHANGELOG.md index 114c61e..0f82324 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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`. diff --git a/Directory.Build.props b/Directory.Build.props index 0bc1c2e..459fd38 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,5 @@ - 1.7.1-alpha.2 + 1.7.1-alpha.3 \ No newline at end of file diff --git a/ricaun.RevitTest.Application/Revit/App.cs b/ricaun.RevitTest.Application/Revit/App.cs index 2ea4a90..66fc5bf 100644 --- a/ricaun.RevitTest.Application/Revit/App.cs +++ b/ricaun.RevitTest.Application/Revit/App.cs @@ -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) { diff --git a/ricaun.RevitTest.Application/Revit/Utils/TestExecuteUtils.cs b/ricaun.RevitTest.Application/Revit/Utils/TestExecuteUtils.cs index 575145e..e907b76 100644 --- a/ricaun.RevitTest.Application/Revit/Utils/TestExecuteUtils.cs +++ b/ricaun.RevitTest.Application/Revit/Utils/TestExecuteUtils.cs @@ -34,8 +34,7 @@ public static async Task 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)); @@ -137,7 +136,7 @@ private static async Task 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 {