dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.01k stars 1.72k forks source link

Can't release the C# object referenced by razor component in BlazorWebView #23654

Open bycreal opened 2 months ago

bycreal commented 2 months ago

Description

There are 2 simple Page in the project: MianPage (Root page) NewPage (showed after click the button in MainPage) But the object(My test object: ViewMode Vm) can't be released after the NewPage popped.

When I use: BlazorWebView.Handler.DisconnectHandler(); The app will be freezing.

Steps to Reproduce

  1. Clicked "New Page"
  2. Press Back
  3. Clicked "New Page" again
  4. Press Back again

Vm2 in NewPage released, but Vm referenced by razor component not released.

Link to public reproduction project repository

https://github.com/bycreal/MauiBlazorFreezing

Version with bug

8.0.40 SR5

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS, Android, Windows, macOS

Affected platform versions

iOS17, macOS 14, windows 10/11

Did you find any workaround?

No response

Relevant log output

No response

github-actions[bot] commented 2 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

QianaJiao commented 2 months ago

This issue has been verified and repro on Visual Studio 17.11.0 Preview 4.0 (8.0.70 & 8.0.40).