Skip to content

When VS debugger is attached, exception handling causes all threads to pause up to 200ms! (makes debugging timing-sensitive code impossible). #122344

@philipag

Description

@philipag

Description

throw-catch can take up to 200ms with VS debugger attached to a MAUI Android app and up to 10ms when debugging under Windows. When debugger is not attached, throw-catch takes ~0ms as expected. See the attached MAUI test app Test1() to run & show throw-catch latency.

Furthermore Test2() shows that thread1 stops running while thread2 is throwing exceptions. So it seems that the entire process is suspended for up to 200ms when 1 thread throws 1 exception while the VS debugger is attached!

MAUI sample app:
MauiAppSlowExceptions.zip

Configuration

.net 10
latest VS 2026 preview
several Android phones tested.

Regression?

This used to be much faster but I don't know with specifically which .Net or VS versions. As it is now, it makes it impossible to debug timing-sensitive code.

Analysis

I don't know if this is a VS or runtime problem but am reporting it here.
I suspect that there is some round-trip traffic between runtime/Android and VS and that during this time the runtime is suspended instead of continuing to run as expected. The measure values are very jittery (100ms to 200ms) and I suspect that is due to the remote VS debugger connection to Android.
I only tested this with a MAUI app since then I can run the test on several platforms. I expect but am not sure that a native windows app will have similar issues.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions