Skip to content

Commit caf3259

Browse files
JerrettDavisfgreinacher
authored andcommitted
Updated FileWrapper async calls to allow errors to bubble up. (#492)
Fixes #491
1 parent cdeb078 commit caf3259

1 file changed

Lines changed: 11 additions & 22 deletions

File tree

System.IO.Abstractions/FileWrapper.cs

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,12 @@ public override void AppendAllLines(string path, IEnumerable<string> contents, E
3030
#if NETCOREAPP2_0
3131
public override Task AppendAllLinesAsync(string path, IEnumerable<string> contents, CancellationToken cancellationToken)
3232
{
33-
File.AppendAllLinesAsync(path, contents, cancellationToken);
34-
return Task.CompletedTask;
33+
return File.AppendAllLinesAsync(path, contents, cancellationToken);
3534
}
3635

3736
public override Task AppendAllLinesAsync(string path, IEnumerable<string> contents, Encoding encoding, CancellationToken cancellationToken)
3837
{
39-
File.AppendAllLinesAsync(path, contents, encoding, cancellationToken);
40-
return Task.CompletedTask;
38+
return File.AppendAllLinesAsync(path, contents, encoding, cancellationToken);
4139
}
4240
#endif
4341

@@ -54,14 +52,12 @@ public override void AppendAllText(string path, string contents, Encoding encodi
5452
#if NETCOREAPP2_0
5553
public override Task AppendAllTextAsync(string path, string contents, CancellationToken cancellationToken)
5654
{
57-
File.AppendAllTextAsync(path, contents, cancellationToken);
58-
return Task.CompletedTask;
55+
return File.AppendAllTextAsync(path, contents, cancellationToken);
5956
}
6057

6158
public override Task AppendAllTextAsync(string path, string contents, Encoding encoding, CancellationToken cancellationToken)
6259
{
63-
File.AppendAllTextAsync(path, contents, encoding, cancellationToken);
64-
return Task.CompletedTask;
60+
return File.AppendAllTextAsync(path, contents, encoding, cancellationToken);
6561
}
6662
#endif
6763

@@ -378,8 +374,7 @@ public override void WriteAllBytes(string path, byte[] bytes)
378374
#if NETCOREAPP2_0
379375
public override Task WriteAllBytesAsync(string path, byte[] bytes, CancellationToken cancellationToken)
380376
{
381-
File.WriteAllBytesAsync(path, bytes, cancellationToken);
382-
return Task.CompletedTask;
377+
return File.WriteAllBytesAsync(path, bytes, cancellationToken);
383378
}
384379
#endif
385380

@@ -553,26 +548,22 @@ public override void WriteAllLines(string path, string[] contents, Encoding enco
553548
#if NETCOREAPP2_0
554549
public override Task WriteAllLinesAsync(string path, IEnumerable<string> contents, CancellationToken cancellationToken)
555550
{
556-
File.WriteAllLinesAsync(path, contents, cancellationToken);
557-
return Task.CompletedTask;
551+
return File.WriteAllLinesAsync(path, contents, cancellationToken);
558552
}
559553

560554
public override Task WriteAllLinesAsync(string path, IEnumerable<string> contents, Encoding encoding, CancellationToken cancellationToken)
561555
{
562-
File.WriteAllLinesAsync(path, contents, encoding, cancellationToken);
563-
return Task.CompletedTask;
556+
return File.WriteAllLinesAsync(path, contents, encoding, cancellationToken);
564557
}
565558

566559
public override Task WriteAllLinesAsync(string path, string[] contents, CancellationToken cancellationToken)
567560
{
568-
File.WriteAllLinesAsync(path, contents, cancellationToken);
569-
return Task.CompletedTask;
561+
return File.WriteAllLinesAsync(path, contents, cancellationToken);
570562
}
571563

572564
public override Task WriteAllLinesAsync(string path, string[] contents, Encoding encoding, CancellationToken cancellationToken)
573565
{
574-
File.WriteAllLinesAsync(path, contents, encoding, cancellationToken);
575-
return Task.CompletedTask;
566+
return File.WriteAllLinesAsync(path, contents, encoding, cancellationToken);
576567
}
577568
#endif
578569

@@ -651,14 +642,12 @@ public override void WriteAllText(string path, string contents, Encoding encodin
651642
#if NETCOREAPP2_0
652643
public override Task WriteAllTextAsync(string path, string contents, CancellationToken cancellationToken)
653644
{
654-
File.WriteAllTextAsync(path, contents, cancellationToken);
655-
return Task.CompletedTask;
645+
return File.WriteAllTextAsync(path, contents, cancellationToken);
656646
}
657647

658648
public override Task WriteAllTextAsync(string path, string contents, Encoding encoding, CancellationToken cancellationToken)
659649
{
660-
File.WriteAllTextAsync(path, contents, encoding, cancellationToken);
661-
return Task.CompletedTask;
650+
return File.WriteAllTextAsync(path, contents, encoding, cancellationToken);
662651
}
663652
#endif
664653
}

0 commit comments

Comments
 (0)