Skip to content

Potential data race between page navigation? #10919

@paperchalice

Description

@paperchalice

Describe the bug

Minimal reproducer: https://github.com/paperchalice/DataRace-20251215 or DataRace-20251215-main.zip

The behavior is similar to data race but I'm not sure. Control flow will always enter the true branch after navigating back.

Why is this important?

This behavior is incorrect when debugging.

Steps to reproduce the bug

  1. Clone the repository.
  2. Target to .NET 10 (Default in this project).
  3. Add a break point at line 44 in MainPage.xaml.cs
  4. Debug project.
  5. Continue
  6. Click ClickMe.
  7. Click GoBack.
  8. Use step over to see the result when debugging.

You can repeat steps 5-8 to see result:

s_flag: False
s_flag: True
s_flag: True
...

Actual behavior

Control flow always step into if body, the Debug output is

s_flag: False
s_flag: True
s_flag: True
...

Expected behavior

Debugger will skip if body after first break point hit, Debug output should be:

s_flag: False

Screenshots

Image

NuGet package version

WinUI 3 - Windows App SDK 1.8.3: 1.8.251106002

Windows version

Windows 11 (24H2): Build 26100

Additional context

Using VS 2026 18.1, only reproducible when targeting to .NET 10, behavior is correct when using lock statement or targeting to .NET 8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageIssue needs to be triaged by the area owners

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions