Skip to content

[net10.0] MAUI no longer marshalls bindable updates to the UI thread #31139

@daltzctr

Description

@daltzctr

Description

I updated my application from .NET 9 to .NET 10 Preview 7 and observed release mode differences and crashes, with no warnings or indicators due to thread propagation issues.

Steps to Reproduce

  1. Create a complex object called MyObject. Have this object expose properties
  2. Create a ViewModel that the UI binds to.
  3. Create a binding for a Picker who binds to List<MyObject>
  4. Spawn a thread, assign List<MyObject>
  5. Observe COMException due to marshalling on the wrong thread (only in release mode)

Expected. No issue, binding should propagate to UI thread.
Actual. Some bindings no longer propagate to UI thread (primitives seem to be safe, but that's because they are thread safe).

Link to public reproduction project repository

  1. Clone repository
  2. Run on Windows in debug mode
  3. Observe that the time label on the UI updates
  4. Run on Windows in release mode
  5. Observe that the time label on the UI no longer updates

https://github.com/daltzctr/MauiRepro31139

Version with bug

10.0.0-preview.7

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

10.0.0-preview.6

Affected platforms

Windows

Affected platform versions

No response

Did you find any workaround?

Wrapping all of the updates to the relevant properties in MainThread.InvokeOnMainThreadAsync, but this is tedious for an application that makes heavy use of threading.

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-dispatchingMain/UI threads, IDispatcher, IDispatcherTimeri/regressionThis issue described a confirmed regression on a currently supported versionp/0Current heighest priority issues that we are targeting for a release.platform/windowsregressed-in-10-preview7s/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions