-
Notifications
You must be signed in to change notification settings - Fork 686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debugger locks up the app when there are many threads/web requests #7938
Comments
Source code for the lazy (after dotnet new maui): <CollectionView x:Name="cv">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid Padding="6">
<Image
Source="{Binding Image}"
Aspect="AspectFill"
HeightRequest="100"
WidthRequest="100"/>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView> public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
var items = new List<Item>();
for (var i = 0; i < 1085; i++)
{
items.Add(new Item
{
Image = $"https://picsum.photos/100/100?image={i}"
});
}
cv.ItemsSource = items;
}
class Item
{
public string? Image { get; set; }
}
} |
Added a mac catalyst sample that also freezes. |
I could simplify this in mac catalyst a bit more: public async void DoWork()
{
await Task.Delay(1000);
Debug.WriteLine("Hello, World!");
for (int i = 0; i < 1100; i++)
{
var cancel = (i % 100) != 0;
Debug.WriteLine($"Starting {i} => cancel: {cancel}");
_ = NewMethod(i, cancel);
await Task.Delay(100);
}
Debug.WriteLine("Done");
}
static async Task NewMethod(int item, bool cancel)
{
try
{
var cts = new CancellationTokenSource();
if (cancel)
cts.CancelAfter(250);
await Task.Run(async () => {
await Task.Delay(1000, cts.Token);
}, cts.Token);
Console.WriteLine($"{item} => done");
}
catch (Exception ex)
{
Debug.WriteLine($"{item} => {ex.Message}");
}
} |
A few questions:
The performance of .NET Exceptions under the debugger is several orders of magnitude worse than when a debugger is attached when it is not, especially if Just My Code isn't enabled. So, I am guessing that is what you are experiencing. But we will see. |
Type: Bug
Not sure who or what is to blame here, but something is causing my app to freeze and the debugger seems to just block on exceptions.
If you run this app with the debugger on Mac Catalyst it will freeze when scrolling quickly. But, if you launch without the debugger, it works fine. Also, if you scroll slow enough so that only 1 or 2 images scroll on screen at a time, then the images load - even with the debugger.
Swapping to labels also work fine.
Images in maui are downloaded using HttpClient, so something is happening when the app starts requesting many images and then cancelling them. I will try reproduce without UI controls as soon as I can.
Extension version: 2.62.18
VS Code version: Code - Insiders 1.97.0-insider (Universal) (d226a2a497b928d78aa654f74c8af5317d3becfb, 2025-01-22T05:05:14.565Z)
OS version: Darwin arm64 23.6.0
Modes:
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
A/B Experiments
The text was updated successfully, but these errors were encountered: