Skip to content

Commit

Permalink
[Blazor] Prevent locking on packaged app content (#10744)
Browse files Browse the repository at this point in the history
(cherry picked from commit 3a40774)
  • Loading branch information
TanayParikh committed Oct 18, 2022
1 parent d841e35 commit 1512f3e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/BlazorWebView/src/Maui/Windows/WinUIWebViewManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,12 @@ protected override async Task HandleWebResourceRequest(CoreWebView2WebResourceRe
var winUIItem = await Package.Current.InstalledLocation.TryGetItemAsync(relativePath);
if (winUIItem != null)
{
var contentStream = await Package.Current.InstalledLocation.OpenStreamForReadAsync(relativePath);
stream = contentStream.AsRandomAccessStream();
using var contentStream = await Package.Current.InstalledLocation.OpenStreamForReadAsync(relativePath);

var memStream = new MemoryStream();
contentStream.CopyTo(memStream);
stream = new InMemoryRandomAccessStream();
await stream.WriteAsync(memStream.GetWindowsRuntimeBuffer());
}
}
else
Expand Down

0 comments on commit 1512f3e

Please sign in to comment.