maui icon indicating copy to clipboard operation
maui copied to clipboard

Throwing in a background thread freezes the UI when debugging

Open pmlemay opened this issue 10 months ago • 6 comments

Description

Hi, i'v created a new MAUI project with the simple click the button feature, added a looping background thread throwing rapidely and it freezes the UI (clicking fast on the button does not refresh the count directly) ONLY when in debugging mode and not while in the 'Start without debugging' mode.

I want to know why and how can i make it so that my debugging is not hindered by lots of throws as my complete project is throwing a lot while handling errors and worked flawlessly in WPF before but migrating it to MAUI now lags my UI actions (ONLY when debugging again)

image

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

8.0.7 SR2

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows, I was not able test on other platforms

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

pmlemay avatar Apr 10 '24 00:04 pmlemay

Can repro this issue at Windows platform on the latest 17.10.0 Preview 3 (8.0.3/8.0.20).

kevinxufei avatar Apr 11 '24 02:04 kevinxufei

I can't repro this: https://github.com/drasticactions/MauiRepros/tree/main/MauiThrowTest

https://github.com/dotnet/maui/assets/898335/abf17a95-a574-4739-bccd-4abed3697cba

I believe this is the same code you have above. If you can repro this, can you create an example showing it? What are you exception settings in Visual Studio? Maybe you're handling all thrown exceptions which would then break the app.

drasticactions avatar Apr 16 '24 07:04 drasticactions

Hi @drasticactions and thanks for looking into this. I created another new .net MAUI App with .net8.0 LTS, only copied your MainPage.xaml.cs into mine, and could reproduce on my machine. I also tried disabling all exception handling as seen in this video and it is also lagging the UI only when debugging and not when launching without debugging.

https://github.com/dotnet/maui/assets/3333868/8fbd7930-72d9-4afb-9c33-b3c36e94af70

pmlemay avatar Apr 16 '24 14:04 pmlemay

Thanks for the issue report @pmlemay! This issue appears to be a problem with Visual Studio, so we ask that you use the VS feedback tool to report the issue. That way it will get to the routed to the team that owns this experience in VS.

If you encounter a problem with Visual Studio, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks.

  1. Go to the Visual Studio for Windows feedback tool or Visual Studio for Mac feedback tool to report the issue
  2. Close this bug, and consider adding a link to the VS Feedback issue so that others can follow its activity there.

Heres the link to the VS Feedback issue https://developercommunity.visualstudio.com/t/Throwing-in-a-background-thread-freezes/10639803?port=1025&fsid=a1c74860-94ec-4935-872e-50c704e06239

pmlemay avatar Apr 16 '24 19:04 pmlemay

@pmlemay I reopened this since it was punted back to this repo, but I still can't repro your issue. If you could create a repro project that can show this, that will help. Also if you could try this within VSCode with the MAUI extension to see if it happens there (if not, maybe it is still something in VS, or else maybe it's a debugger issue, or something within MAUI although IMO based on the looks of it, I doubt it at the moment)..

drasticactions avatar Jun 26 '24 05:06 drasticactions