Skip to content

Commit

Permalink
Avoid cancellation exception on task completion
Browse files Browse the repository at this point in the history
  • Loading branch information
glopesdev committed Feb 24, 2024
1 parent 6ae3248 commit dc078c4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Bonsai.Configuration/Bonsai.Configuration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<VersionPrefix>2.8.1</VersionPrefix>
<VersionPrefix>2.8.2</VersionPrefix>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Bonsai.NuGet\Bonsai.NuGet.csproj" />
Expand Down
12 changes: 7 additions & 5 deletions Bonsai.Configuration/ConsoleBootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@ public ConsoleBootstrapper(string path)

protected override async Task RunPackageOperationAsync(Func<Task> operationFactory)
{
await operationFactory().ContinueWith(task =>
try { await operationFactory(); }
catch (Exception ex)
{
if (task.Exception is AggregateException ex)
if (ex is AggregateException aex)
{
foreach (var error in ex.InnerExceptions)
foreach (var error in aex.InnerExceptions)
{
PackageManager.Logger.LogError(error.Message);
}
}
else PackageManager.Logger.LogError(task.Exception.Message);
}, TaskContinuationOptions.OnlyOnFaulted);
else PackageManager.Logger.LogError(ex.Message);
throw;
}
}
}
}
2 changes: 1 addition & 1 deletion Bonsai.Player/Bonsai.Player.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageLicenseUrl></PackageLicenseUrl>
<PackageIcon>icon.png</PackageIcon>
<PackageIconUrl></PackageIconUrl>
<VersionPrefix>2.8.1</VersionPrefix>
<VersionPrefix>2.8.2</VersionPrefix>
<PackAsTool>true</PackAsTool>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Bonsai/Bonsai.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<UseWindowsForms>true</UseWindowsForms>
<TargetFramework>net48</TargetFramework>
<VersionPrefix>2.8.1</VersionPrefix>
<VersionPrefix>2.8.2</VersionPrefix>
<OutputType>Exe</OutputType>
<DisableWinExeOutputInference>true</DisableWinExeOutputInference>
<ApplicationIcon>..\Bonsai.Editor\Bonsai.ico</ApplicationIcon>
Expand Down
2 changes: 1 addition & 1 deletion Bonsai32/Bonsai32.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<TargetFramework>net48</TargetFramework>
<PlatformTarget>x86</PlatformTarget>
<VersionPrefix>2.8.1</VersionPrefix>
<VersionPrefix>2.8.2</VersionPrefix>
<OutputType>Exe</OutputType>
<OutputPath>..\Bonsai\bin\$(Configuration)\</OutputPath>
<ApplicationIcon>..\Bonsai.Editor\Bonsai.ico</ApplicationIcon>
Expand Down

0 comments on commit dc078c4

Please sign in to comment.