Use always innerException for Task.AsUniTask

pull/500/head
hadashiA 2023-09-08 18:43:41 +09:00
parent c170af5642
commit 62a2a2e8f9
2 changed files with 11 additions and 2 deletions

View File

@ -21,6 +21,15 @@ namespace NetCoreTests
});
}
[Fact]
public async Task PropagateExceptionWhenAll()
{
await Assert.ThrowsAsync<InvalidOperationException>(async () =>
{
await Task.WhenAll(ThrowAsync(), ThrowAsync()).AsUniTask();
});
}
async Task ThrowAsync()
{
throw new InvalidOperationException();

View File

@ -28,7 +28,7 @@ namespace Cysharp.Threading.Tasks
p.TrySetCanceled();
break;
case TaskStatus.Faulted:
p.TrySetException(x.Exception.InnerExceptions.Count == 1 ? x.Exception.InnerException : x.Exception);
p.TrySetException(x.Exception.InnerException);
break;
case TaskStatus.RanToCompletion:
p.TrySetResult(x.Result);
@ -58,7 +58,7 @@ namespace Cysharp.Threading.Tasks
p.TrySetCanceled();
break;
case TaskStatus.Faulted:
p.TrySetException(x.Exception.InnerExceptions.Count == 1 ? x.Exception.InnerException : x.Exception);
p.TrySetException(x.Exception.InnerException);
break;
case TaskStatus.RanToCompletion:
p.TrySetResult();