-
Notifications
You must be signed in to change notification settings - Fork 490
Closed
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues
Did you read the "Reporting a bug" section on Contributing file?
- I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
Current Behavior
When we open and close the popup using the ShowPopupAsync method and read a file using the file stream the "Access to the path denied" exception occurs.
Code snippet:
private async void OnPickFileButtonClicked(object sender, EventArgs e)
{
FileResult result = await FilePicker.PickAsync(new PickOptions
{
PickerTitle = "Pick a File",
});
if (result == null) return;
try
{
path = result.FullPath;
await Application.Current.MainPage.ShowPopupAsync(myPopUp);
using var fs1 = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.None);
var reader = new StreamReader(fs1);
exceptionLabel.Text = "No exception";
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
exceptionLabel.Text = ex.Message;
}
}
Expected Behavior
When we open and close the popup using the ShowPopupAsync method and read a file using the file stream the "Access to the path denied" exception should not occur.
Steps To Reproduce
- Run the sample.
- Click pick a file button
- Popup opens, click outside and close the popup.
- The FileStream file read line gets hit and throws an exception as "Access to the path denied".
Link to public reproduction project repository
Environment
- .NET MAUI CommunityToolkit:11.2.0
- OS:iOS 16.7.10
- .NET MAUI:9.0.50Anything else?
No response
Reactions are currently unavailable