Description
Android app has 2 pages, 1 home page and 1 page containing WebView. From home page user can go to the WebView page and open a site, come back to the home page and again go to WebView page to open other site, user can do this multiple times.
After few such cycles, in edge://inspect/#devices you see multiple instances of the WebView and with page navigating away the WebView is not going away, I am concerned that this is causing memory leak.

I see the WebView class does not has any close/dispose/destroy kind of methods. What is the proper way to close the page containing WebView so that all resources are properly released?
I have attached the sample app which reproduces the issue. Pasting some code snippets for quick reference -
private async void OnCounterClicked(object sender, EventArgs e)
{
List<string> siteList = new List<string>() { "https://www.google.com", "https://www.bing.com", "https://www.youtube.com", "https://www.microsoft.com" };
Random rnd = new Random();
await Navigation.PushAsync(new NewPage1(siteList[rnd.Next(0, siteList.Count)]));
}
public NewPage1(string site)
{
InitializeComponent();
webview.Source = site;
}
private void GoBack(object sender, EventArgs e)
{
Navigation.PopAsync();
}
Steps to Reproduce
- Build and start the app attached in the zip on Android device.
- Click on 'Click me'
- New page with site loads, click 'Go Back'
- Repeat step 2 and 3 few times.
- Open edge://inspect/#devices
- Look for the device, you'll see all instances of WebView
MauiAppWebView.zip
Link to public reproduction project repository
No response
Version with bug
7.0.96
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
No response
Description
Android app has 2 pages, 1 home page and 1 page containing WebView. From home page user can go to the WebView page and open a site, come back to the home page and again go to WebView page to open other site, user can do this multiple times.
After few such cycles, in
edge://inspect/#devicesyou see multiple instances of the WebView and with page navigating away the WebView is not going away, I am concerned that this is causing memory leak.I see the WebView class does not has any close/dispose/destroy kind of methods. What is the proper way to close the page containing WebView so that all resources are properly released?
I have attached the sample app which reproduces the issue. Pasting some code snippets for quick reference -
Steps to Reproduce
MauiAppWebView.zip
Link to public reproduction project repository
No response
Version with bug
7.0.96
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
No response