Skip to content

Commit ccbf92e

Browse files
committed
Fixed issue with temp file not getting created due to encryption
1 parent f055cd1 commit ccbf92e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/EventLogExpert.UI/Services/DebugLogService.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ public async IAsyncEnumerable<string> LoadAsync()
7373

7474
try
7575
{
76-
File.Copy(_fileLocationOptions.LoggingPath, tempPath, overwrite: true);
76+
// Use FileStream copy instead of File.Copy to avoid copying encryption attributes
77+
// which can fail if source is encrypted but temp folder doesn't support encryption
78+
await using var sourceStream = new FileStream(_fileLocationOptions.LoggingPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
79+
await using var destStream = new FileStream(tempPath, FileMode.Create, FileAccess.Write, FileShare.None);
80+
await sourceStream.CopyToAsync(destStream);
7781
}
7882
finally
7983
{

0 commit comments

Comments
 (0)