Skip to content

Element._pendingHandlerUpdatesFromBPSet (unsynchronized HashSet<string>) is corrupted by concurrent bindable-property writes #37441

In progress

Description

@brunck

Description

Microsoft.Maui.Controls.Element tracks whether a bindable-property handler update is pending
using a per-instance HashSet<string> field, _pendingHandlerUpdatesFromBPSet. The Add →
base call → Remove bracket is only safe under the assumption that SetValue on a given
Element is always called from a single thread:

src/Controls/src/Core/Element/Element.cs (MAUI main @ 013e8bfb1d):

HashSet<string> _pendingHandlerUpdatesFromBPSet = new HashSet<string>();          // :701

private protected override void OnBindablePropertySet(BindableProperty property, object original,
    object value, bool changed, bool willFirePropertyChanged)
{
    if (willFirePropertyChanged)
        _pendingHandlerUpdatesFromBPSet.Add(property.PropertyName);              // :706

    base.OnBindablePropertySet(property, original, value, changed, willFirePropertyChanged);
    _pendingHandlerUpdatesFromBPSet.Remove(property.PropertyName);               // :710
    UpdateHandlerValue(property.PropertyName, changed);
}

protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
    bool waitForHandlerUpdateToFireFromBP =
        _pendingHandlerUpdatesFromBPSet.Contains(propertyName);                  // :730
    ...
}

That assumption doesn't hold: nothing prevents two threads from calling SetValue on the same
Element concurrently (a view-model updating a property from a background thread while an
animation or another property write happens on the UI thread is an ordinary pattern, not a
documented misuse). When that happens, HashSet<string> — which is not thread-safe — is mutated
concurrently and its internal state is corrupted. The corruption surfaces later, from inside the
HashSet's own code, as one of two exceptions that name neither the property being written nor
the thread that wrote it:

  • System.IndexOutOfRangeException from HashSet.AddIfNotPresent
  • System.InvalidOperationException: "Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state..."

A single-threaded HashSet essentially never throws either of these, which is what makes both
signatures diagnostic of concurrent corruption rather than an app-level logic error. We hit both
signatures in production (trimmed + AOT Release build) with no informative stack beyond
Element.OnBindablePropertySet, and built the attached repro to isolate the mechanism.

Suggested direction

The intended lifetime of this state is one synchronous call on one thread, so the natural fix is
to stop storing it per-instance. Thread-local storage removes the race by construction — no lock,
no contention — and also removes one HashSet<string> allocation per Element, which is already
scoped as DS06 in the memory-allocation issue (#34149).

One interaction is worth surfacing rather than glossing over, because it shapes what the right
storage actually is: the Remove at Element.cs:710 is unconditional. It runs even when
willFirePropertyChanged was false and nothing was added, so the marker is already unbalanced
with respect to re-entrancy — a nested SetValue for the same property name clears the outer
call's marker today, single-threaded, per element. A bare [ThreadStatic] static HashSet<string>
would fix the race and the allocation but widen that existing aliasing from the same element to
any element on that thread. Storing a depth count, or keying on the (element, property) pair,
would avoid the race without widening it.

Two sibling collections on BindableObject appear to follow the same unsynchronized-per-instance
pattern, but nothing in this repro reproduces against them and this issue makes no claim about
them.

Does the bug reproduce also in a native app?

N/A — the defect is in Microsoft.Maui.Controls managed code (Element.cs), not in either
platform's native UI toolkit. The two platform-native reference points (Android's
ViewRootImpl.checkThread, iOS's UIKitThreadAccessException) are shown above specifically
because they demonstrate how a platform-mapped property can mask this bug rather than exhibit
it, which is why scenario A deliberately avoids any mapped property.

Steps to Reproduce

  1. Clone the linked repro project and deploy BindablePropertyConcurrencyRepro to a physical
    Android device (or an iOS device/simulator).
  2. Press A, then B. Each button runs a bounded 30 s stress loop against a single shared
    Label and reports CLEAN or THREW, with the caught exception's full ToString()
    rendered below the status line.
Button What it does
A — Isolated mechanism Two Task.Run loops writing two different custom bindable properties on the same element. Neither property is in any platform property mapper, so no platform view is touched on any thread — this isolates the HashSet race from any platform thread-affinity check.
B — Unmarshalled framework path One background loop calling VisualStateManager.GoToState, racing a fade animation driven by the framework's own ticker on the UI thread. The app makes exactly one off-thread call — GoToState is not documented as UI-thread-only, takes no dispatcher, does not marshal, and driving it from view-model state is an ordinary MAUI pattern.

A is the isolation; B is the complaint. A deliberately has the app write two bindable
properties concurrently — that's the app's mistake, and its only job is to show the mechanism
with nothing else in the frame. B is the case that does not require the app to do anything
unusual: one off-thread call to a documented, non-UI-thread-only API, racing the framework's own
UI-thread animation. There is no documented rule the app broke in B.

Expected: an off-thread bindable-property write may lose an update or produce a platform
thread-affinity error, but must not corrupt framework-internal state or throw from a HashSet
operation unrelated to the property being written.

Actual: IndexOutOfRangeException / InvalidOperationException thrown from inside
HashSet<string> on the Element.OnBindablePropertySet path, naming neither the property nor
the thread involved.

Link to public reproduction project repository

https://github.com/brunck/reproductions/tree/master/BindablePropertyConcurrencyRepro

Version with bug

10.0.90

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android, iOS

Affected platform versions

  • Android 16 (Pixel 8a, physical device)
  • iOS (iPhone 11, physical device)

Did you find any workaround?

No. The only mitigation is avoiding concurrent bindable-property writes to the same Element
entirely — including the framework's own VisualStateManager.GoToState racing an animation,
which is not something app code visibly controls.

Relevant log output

Pixel 8a, Android 16, 9 cores, Release build (trimmed + AOT, matching the configuration our
production crash occurred in), Microsoft.Maui.Controls 10.0.90+8e2547a4707f745a27a7791495b240e756926980.

Scenario Result Time to failure Exception
A THREW, 3/3 consecutive runs from a fresh process 0.02 s, 0.03 s, 0.02 s IndexOutOfRangeException and InvalidOperationException, both in HashSet.AddIfNotPresent
B THREW, 3/3 consecutive runs from a fresh process 0.68 s, 0.56 s, 0.67 s InvalidOperationException ×2 and IndexOutOfRangeException ×1, all in HashSet.AddIfNotPresent; thrown on the background thread each time

Both production signatures appear across three runs of B alone, and again across three runs
of A, all from the same unchanged binary — one root cause surfaces as two unrelated-looking
exceptions, neither of which names the property, the thread, or the corrupted collection. B's
three runs were each thrown on the background GoToState thread while the animation ran on the
UI thread.

iOS (single run per scenario, physical device, Microsoft.Maui.Controls 10.0.90):

Scenario Result Time to failure Exception
A THREW 0.01 s InvalidOperationException — one of the same two production signatures as Android
B THREW, caught 0.00 s UIKit.UIKitThreadAccessException, on the background GoToState thread
B THREW, caught, ×25 consecutive presses from a fresh launch — no termination 0.00 s each UIKit.UIKitThreadAccessException every time; B alone does not terminate the process
A/B alternating, 5 presses each PROCESS TERMINATED, uncaught — IndexOutOfRangeException in HashSet.AddIfNotPresent, on thread 1, in the layout pass — see follow-up comment
B (earlier harness build) PROCESS TERMINATED, uncaught — InvalidOperationException in HashSet.AddIfNotPresent, on thread 1, in the animation ticker

A corroborates cross-platform: with no platform view in the frame, iOS produces
InvalidOperationException from the same HashSet corruption as Android, confirming the defect
lives in platform-agnostic Controls code, not in either platform's binding to it.

Corrected — see the comment below. This paragraph originally said B does not corroborate on iOS. That was wrong: B does corroborate, and the iOS failure is the most severe one in this repro.

B corroborates on iOS, but asymmetrically. GoToState's state transition applies/unapplies Setters that write TextColor, which is platform-mapped; on iOS that reaches UILabel, so UIKit's own thread-affinity check fires on the background thread as UIKitThreadAccessException and the scenario catches it at 0.00 s. What that check does not do is prevent the corruption — the off-thread SetValue still mutates _pendingHandlerUpdatesFromBPSet before UIKit stops it, concurrently with the UI thread's animation writing Opacity to the same element. The UI thread then trips over the corrupted set inside MAUI's animation ticker, with no app frame on the stack, and the process terminates. The platform check only changes which exception the app sees first; the real corruption lands later, elsewhere, fatally. Full trace in the comment below.

This is still useful context in one respect: UIKit's check is a named, documented exception that identifies the actual violation, whereas MAUI's own Controls layer has no equivalent for _pendingHandlerUpdatesFromBPSet — the failure mode there is an unrelated HashSet exception that names neither the property, nor the thread, nor the corrupted collection.

We also expected the corruption might present as SIGSEGV/SIGABRT with no managed stack under
full AOT; instead every iOS failure — including the uncaught one that terminates the process — produced a complete managed stack with a normal ToString(), no different in kind from Android.

Android — A, IndexOutOfRangeException
System.IndexOutOfRangeException: Arg_IndexOutOfRangeException
   at System.Collections.Generic.HashSet`1[[System.String, ...]].AddIfNotPresent(String , Int32& )
   at System.Collections.Generic.HashSet`1[[System.String, ...]].Add(String )
   at Microsoft.Maui.Controls.Element.OnBindablePropertySet(BindableProperty property, Object original, Object value, Boolean changed, Boolean willFirePropertyChanged)
   at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)
   at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value)
   at BindablePropertyConcurrencyRepro.RaceLabel.set_RaceBeta(Int32 value)
Android — A, InvalidOperationException, same binary, same button
System.InvalidOperationException: InvalidOperation_ConcurrentOperationsNotSupported
   at System.Collections.Generic.HashSet`1[[System.String, ...]].AddIfNotPresent(String , Int32& )
   at System.Collections.Generic.HashSet`1[[System.String, ...]].Add(String )
   at Microsoft.Maui.Controls.Element.OnBindablePropertySet(BindableProperty property, Object original, Object value, Boolean changed, Boolean willFirePropertyChanged)
   at Microsoft.Maui.Controls.BindableObject.SetValueActual(...)
   at Microsoft.Maui.Controls.BindableObject.SetValueCore(...)
   at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value)
   at BindablePropertyConcurrencyRepro.RaceLabel.set_RaceBeta(Int32 value)
Android — B, via VisualStateManager.GoToState, one off-thread call
System.IndexOutOfRangeException: Arg_IndexOutOfRangeException
   at System.Collections.Generic.HashSet`1[[System.String, ...]].AddIfNotPresent(String , Int32& )
   at System.Collections.Generic.HashSet`1[[System.String, ...]].Add(String )
   at Microsoft.Maui.Controls.Element.OnBindablePropertySet(BindableProperty property, Object original, Object value, Boolean changed, Boolean willFirePropertyChanged)
   at Microsoft.Maui.Controls.BindableObject.ClearValueCore(BindableProperty property, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.BindableObject.ClearValue(BindableProperty property, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.Setter.UnApply(BindableObject target, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.VisualStateManager.GoToState(VisualElement visualElement, String name)
iOS — A, InvalidOperationException
System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
   at System.Collections.Generic.HashSet`1[[System.String, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].AddIfNotPresent(String value, Int32& location)
   at Microsoft.Maui.Controls.Element.OnBindablePropertySet(BindableProperty property, Object original, Object value, Boolean changed, Boolean willFirePropertyChanged)
   at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)
   at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value)
   at BindablePropertyConcurrencyRepro.RaceLabel.set_RaceAlpha(Int32 value) in RaceLabel.cs:line 28
   at BindablePropertyConcurrencyRepro.MainPage.<>c__DisplayClass4_0.<RunScenarioA>b__0(CancellationToken token) in MainPage.xaml.cs:line 47
   at BindablePropertyConcurrencyRepro.RunContext.<>c__DisplayClass20_0.<Background>b__0() in RunContext.cs:line 43

(Remaining frames scrolled off-screen in the on-device capture; the frames above are the
diagnostic ones — same HashSet.AddIfNotPresent → Element.OnBindablePropertySet chain as
Android.)

iOS — B, masked by UIKitThreadAccessException (never reaches the HashSet)
UIKit.UIKitThreadAccessException: UIKit Consistency error: you are calling a UIKit method that can only be invoked from the UI thread.
   at UIKit.UIApplication.EnsureUIThread() in /Users/cloudtest/vss/_work/1/s/macios/src/UIKit/UIApplication.cs:line 133
   at UIKit.UILabel.set_TextColor(UIColor value) in /Users/cloudtest/vss/_work/1/s/macios/src/build/dotnet/ios/generated-sources/UIKit/UILabel.g.cs:line 812
   at Microsoft.Maui.Platform.LabelExtensions.UpdateTextColor(UILabel platformLabel, ITextStyle textStyle, UIColor defaultColor)
   at Microsoft.Maui.Handlers.LabelHandler.MapTextColor(ILabelHandler handler, ILabel label)
   at Microsoft.Maui.PropertyMapper`2[...].<Add>b__0(IElementHandler h, IElement v)
   at Microsoft.Maui.Controls.Label.MapTextColor(ILabelHandler handler, Label label, Action`2 baseMethod)
   at Microsoft.Maui.PropertyMapperExtensions.<>c__DisplayClass1_0`2[...].<ModifyMapping>g__newMethod|0(IElementHandler handler, IElement view)
   at Microsoft.Maui.PropertyMapper`2[...].<Add>b__0(IElementHandler h, IElement v)
   at Microsoft.Maui.PropertyMapper.TryUpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView)
   at Microsoft.Maui.PropertyMapper.UpdateProperty(IElementHandler viewHandler, IElement virtualView, String property)
   at Microsoft.Maui.Handlers.ElementHandler.UpdateValue(String property)
   at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)
   at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.Setter.Apply(BindableObject target, SetterSpecificity specificity)

(A few generic-type-argument frames collapsed to [...] for readability; nothing diagnostic was
in them. This is the concrete illustration of "B is masked on iOS": the call never gets past
UILabel.set_TextColor to reach Element.OnBindablePropertySet/the HashSet at all, unlike
Android where the race wins and the real corruption surfaces instead.)

Activity

  1. added
    t/bug
    on Aug 14, 2026
  2. brunck commented on Aug 14, 2026

    @brunck
    ContributorAuthor

    May be the same as this issue.

  3. brunck commented on Aug 14, 2026

    @brunck
    ContributorAuthor

    Correction: scenario B does reproduce on iOS, and the iOS failure is worse than what I originally filed

    Two statements in the original post are wrong, and both understate this. I've corrected the repro README and I'm recording the correction here rather than silently editing.

    What I got wrong. I saw UIKitThreadAccessException thrown on the background thread at 0.00 s and concluded that UIKit's thread-affinity check was stopping the write before it could corrupt the set. It isn't. The check stops that call on that thread. It does not prevent the corruption and it does not protect the collection — it only changes which exception the app happens to see first.

    What actually happens. Scenario B makes one off-thread VisualStateManager.GoToState call while the UI thread runs a FadeTo on the same element. The off-thread SetValue still mutates _pendingHandlerUpdatesFromBPSet before UIKit's check fires. Run B repeatedly and the UI thread is the one that trips over the corrupted set — inside MAUI's own animation ticker. The process terminates.

    === AppDomain.UnhandledException ===
    Threw on thread: 1
    System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
       at System.Collections.Generic.HashSet`1[[System.String, ...]].AddIfNotPresent(String value, Int32& location)
       at Microsoft.Maui.Controls.Element.OnBindablePropertySet(BindableProperty property, Object original, Object value, Boolean changed, Boolean willFirePropertyChanged)
       at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)
       at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity)
       at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value)
       at Microsoft.Maui.Controls.VisualElement.set_Opacity(Double value)
       at Microsoft.Maui.Controls.ViewExtensions.<>c.<FadeToAsync>b__3_0(VisualElement v, Double value)
       at Microsoft.Maui.Controls.ViewExtensions.<>c__DisplayClass1_0.<AnimateToAsync>g__UpdateProperty|0(Double f)
       at Microsoft.Maui.Controls.Animation.<>c__DisplayClass2_0.<.ctor>b__0(Double f)
       at Microsoft.Maui.Controls.Animation.<GetCallback>b__5_0(Double f)
       at Microsoft.Maui.Controls.AnimationExtensions.<>c__DisplayClass21_0`1[[System.Double, ...]].<AnimateInternal>b__0(Double f)
       at Microsoft.Maui.Controls.AnimationExtensions.HandleTweenerUpdated(Object o, EventArgs args)
       at Microsoft.Maui.Controls.Tweener.Step(Int64 step)
       at Microsoft.Maui.Controls.TweenerAnimation.OnTick(Double millisecondsSinceLastUpdate)
       at Microsoft.Maui.Animations.Animation.Tick(Double milliseconds)
       at Microsoft.Maui.Animations.AnimationManager.<OnFire>g__OnAnimationTick|20_0(Animation animation, <>c__DisplayClass20_0& )
       at Microsoft.Maui.Animations.AnimationManager.OnFire()
       at Microsoft.Maui.Animations.PlatformTicker.<Start>b__3_0()
       at Foundation.NSActionDispatcher.Apply()
       at Foundation.NSActionDispatcher.__Registrar_Callbacks__.callback_3687_Foundation_NSActionDispatcher_Apply(IntPtr pobj, IntPtr sel, IntPtr* exception_gchandle)
    --- End of stack trace from previous location ---
       at ObjCRuntime.Runtime.ThrowException(IntPtr gchandle)
       at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName)
       at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass)
       at BindablePropertyConcurrencyRepro.Program.Main(String[] args)
    

    Three things about that stack:

    • It is thread 1. The corruption surfaces on the UI thread, not on the thread that made the off-thread call.
    • Between Program.Main and the throw there is not one line of application code. ViewExtensions.FadeToAsync → Animation → Tweener → AnimationManager.OnFire → PlatformTicker → NSActionDispatcher is framework code start to finish.
    • It unwinds out through UIApplication.Main. There is nothing for an app to catch. On Android the equivalent throw can at least be swallowed via the Handled flag on AndroidEnvironment.UnhandledExceptionRaiser; iOS has no equivalent, since ObjCRuntime.Runtime.MarshalManagedException can change how the exception crosses into native code but cannot suppress it.

    So the severity is higher than what I filed. A single off-thread GoToState — a method that is not documented as UI-thread-only, takes no dispatcher, and does not marshal — can terminate an iOS app from inside MAUI's animation ticker, with no app frame on the stack and no exception the app is able to catch.

    Caveat, stated plainly: unlike the Android numbers in the original post, I don't have a clean run count for this one. It was reproduced on a physical device by pressing B repeatedly across several consecutive runs, not deterministically on a first press. Happy to quantify it if that's useful for triage.

    Finally, correcting the AOT note in the original post: the expectation that this might present as SIGSEGV/SIGABRT with no managed stack under full AOT still did not hold — even the uncaught, process-terminating failure produced a complete managed stack.

  4. brunck commented on Aug 14, 2026

    @brunck
    ContributorAuthor

    Follow-up on iOS: correcting the reproduction recipe, and a second — worse — failure path. Both from a current build of the repro.

    1. The recipe. My comment above says "run B repeatedly." That's wrong. Twenty-five consecutive B presses from a fresh launch never terminate the process — every one produces only the caught UIKitThreadAccessException on the background thread. What does terminate it is alternating A and B, five presses each.

    The asymmetry is consistent with the mechanism: under UIKit's thread check, B's background loop dies on its first iteration, so each B press buys a single off-thread write, whereas A's two loops run unchecked and generate the sustained concurrent traffic that actually corrupts the set.

    2. The UI thread doesn't only die in the animation ticker. On the current build, the thread-1 termination came through the layout pass:

    === AppDomain.UnhandledException === 2026-08-14 18:26:17
    Threw on thread: 1
    System.IndexOutOfRangeException: Index was outside the bounds of the array.
       at System.Collections.Generic.HashSet`1[[System.String, ...]].AddIfNotPresent(String value, Int32& location)
       at Microsoft.Maui.Controls.Element.OnBindablePropertySet(BindableProperty property, Object original, Object value, Boolean changed, Boolean willFirePropertyChanged)
       at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)
       at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity)
       at Microsoft.Maui.Controls.BindableObject.SetValue(BindablePropertyKey propertyKey, Object value)
       at Microsoft.Maui.Controls.VisualElement.set_Width(Double value)
       at Microsoft.Maui.Controls.VisualElement.UpdateBoundsComponents(Rect bounds)
       at Microsoft.Maui.Controls.VisualElement.set_Frame(Rect value)
       at Microsoft.Maui.Controls.VisualElement.ArrangeOverride(Rect bounds)
       at Microsoft.Maui.Controls.Label.ArrangeOverride(Rect bounds)
       at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IView.Arrange(Rect bounds)
       at Microsoft.Maui.Layouts.LayoutExtensions.ArrangeContent(IContentView contentView, Rect bounds)
       at Microsoft.Maui.Controls.TemplatedView.Microsoft.Maui.ICrossPlatformLayout.CrossPlatformArrange(Rect bounds)
       at Microsoft.Maui.Platform.MauiView.CrossPlatformArrange(CGRect bounds)
       at Microsoft.Maui.Platform.MauiView.LayoutSubviews()
       at Microsoft.Maui.Platform.ContentView.LayoutSubviews()
       at Microsoft.Maui.Platform.ContentView.__Registrar_Callbacks__.callback_447_Microsoft_Maui_Platform_ContentView_LayoutSubviews(IntPtr pobj, IntPtr sel, IntPtr* exception_gchandle)
    --- End of stack trace from previous location ---
       at ObjCRuntime.Runtime.ThrowException(IntPtr gchandle)
       at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName)
       at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass)
       at BindablePropertyConcurrencyRepro.Program.Main(String[] args)
    

    Note the overload: SetValue(BindablePropertyKey, Object). Width is a read-only bindable property — an application cannot write it, only the framework can. The UI-thread writer here is MAUI's own layout system, arranging the element because UIKit called LayoutSubviews().

    That is harder to characterise as application misuse than the ticker stack was. Starting an animation is something an app chose to do; being arranged is not. Every element that appears on screen goes through ArrangeOverride.

    The off-thread side of the same race is the next entry in the report, same second:

    === A (custom BPs) THREW after 0.00s === 2026-08-14 18:26:17
    Threw on thread: 5
    System.IndexOutOfRangeException: Index was outside the bounds of the array.
       at System.Collections.Generic.HashSet`1[[System.String, ...]].AddIfNotPresent(String value, Int32& location)
       …
    

    Summary of where this leaves iOS. The thread-1 termination has now been observed on two independent UI-thread paths — layout (set_Width) and animation (set_Opacity) — carrying both production signatures (IndexOutOfRangeException here, InvalidOperationException in the earlier stack). The corruption isn't tied to a framework subsystem. It's tied to the element: whatever the UI thread touches that element with next is what fails.

  5. TamilarasanSF4853 commented on Aug 17, 2026

    @TamilarasanSF4853
    Contributor

    This issue has been validated in Visual Studio Code 1.133.0 with .NET MAUI versions 10.0.0 and 10.0.90. It can be reproduced on both Android and iOS platforms.

    Screen.Recording.2026-08-17.at.11.12.04.AM.mov
  6. added
    s/verified
    s/triaged
    on Aug 17, 2026
  7. added this to the Backlog milestone on Aug 17, 2026
  8. shnaz commented on Sep 22, 2026

    @shnaz

    Hello, we are also experiencing this issue

    System.InvalidOperationException: InvalidOperation_ConcurrentOperationsNotSupported (System.InvalidOperationException)
    at System.Collections.Generic.HashSet1[[System.String, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].FindItemIndex(String ) at System.Collections.Generic.HashSet1[[System.String, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Contains(String item)
    at Microsoft.Maui.Controls.Element.OnPropertyChanged(String propertyName)
    at Microsoft.Maui.Controls.BindableObject.OnBindablePropertySet(BindableProperty property, Object original, Object value, Boolean didChange, Boolean willFirePropertyChanged)
    at Microsoft.Maui.Controls.Element.OnBindablePropertySet(BindableProperty property, Object original, Object value, Boolean changed, Boolean willFirePropertyChanged)
    at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)
    at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity)
    at Microsoft.Maui.Controls.BindingExpression.ApplyCore(Object sourceObject, BindableObject target, BindableProperty property, Boolean fromTarget, SetterSpecificity specificity)
    at Microsoft.Maui.Controls.BindingExpression.Apply(Boolean fromTarget)
    at Microsoft.Maui.Controls.BindingExpression.BindingExpressionPart.b__50_0()
    at Microsoft.Maui.Dispatching.Dispatcher.<>c__DisplayClass9_0.b__0()
    at CoreFoundation.DispatchQueue.static_dispatcher_to_managed(IntPtr context)
    at UIKit.UIApplication.UIApplicationMain(Int32 , String[] , IntPtr , IntPtr )
    at UIKit.UIApplication.Main(String[] , Type , Type )
    at FieldApp.iOS.Program.Main(String[] args)

  9. added
    partner/syncfusion
    on Sep 29, 2026
  10. removed
    partner/syncfusion
    on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform/androidplatform/ioss/triageds/verifiedt/bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions