Skip to content

6.7 desktop apps break under the debugger: "The field is invalid for initializing array or span" #25626

Closed

Description

@agneszitte

What happens

When a desktop app on Uno Platform 6.7 runs under a debugger with JIT optimizations turned off, every visual state change throws:

System.ArgumentException: The field is invalid for initializing array or span.

Depending on where the exception is caught, buttons stop responding or the app stays on the splash screen. Running the same app without the debugger works.

In Visual Studio the debugger stops on a user-unhandled ArgumentException in ComparePropertyName. Rider doesn't stop, but buttons stop reacting.

What should happen

The app behaves the same with and without the debugger.

Steps to reproduce

  1. Create an app with Uno.Sdk 6.7.30: dotnet new unoapp -o DebugRepro -preset recommended -platforms desktop
  2. Start it under the debugger with JIT optimizations turned off:
    • Rider: Run with Debug (JIT optimizations are disabled by default).
    • Visual Studio: check Tools > Options > Debugging > General > "Suppress JIT optimization on module load (Managed only)", then press F5.
    • Without an IDE: build the desktop target, then start the built app with the environment variable DOTNET_JITMinOpts=1.
  3. Hover over a button and click it.

Environment

  • Uno.Sdk 6.7.18, 6.7.22 and 6.7.30.
  • Desktop (Skia) on Windows, macOS and Linux. WebAssembly, Android and iOS are not affected.
  • Confirmed in Rider 2026.2.3.1 and 2026.3 EAP 7 (default settings) and Visual Studio 2026 (option above checked). VS Code keeps JIT optimizations on by default.
  • Reproduces every time.

Workarounds

  • Rider: Settings > Build, Execution, Deployment > Debugger > .NET Languages: uncheck "Disable JIT optimization on module load".
  • Visual Studio: uncheck "Suppress JIT optimization on module load (Managed only)".
  • Or run without debugging.

Notes

Stack trace
System.ArgumentException: The field is invalid for initializing array or span.
   at System.Runtime.CompilerServices.RuntimeHelpers.GetSpanDataFrom(RuntimeFieldHandle fldHandle, RuntimeTypeHandle targetTypeHandle, Int32& count)
   at System.Runtime.CompilerServices.RuntimeHelpers.CreateSpan[T](RuntimeFieldHandle fldHandle)
   at Uno.UI.DataBinding.BindingPath.BindingItem.<Equals>g__ComparePropertyName|61_0(String name1, String name2)
   at Uno.UI.DataBinding.BindingPath.BindingItem.Equals(BindingItem that)
   at Uno.UI.DataBinding.BindingPath.PrefixOfOrEqualTo(BindingPath that)
   at Microsoft.UI.Xaml.VisualStateGroup.<>c__DisplayClass39_0.<ClearPropertiesNotSetInNextState>b__0(BindingPath path)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at Microsoft.UI.Xaml.VisualStateGroup.ClearPropertiesNotSetInNextState(...)

Activity

  1. added
    kind/bug
    triage/untriaged
    platform/desktop 🖥️
    on Oct 21, 2026
  2. agneszitte commented on Oct 21, 2026

    @agneszitte
    MemberAuthor

    This is already fixed on master (and in the 6.8 dev builds) by #24050.
    A backport to release/stable/6.7 is in progress for the next upcoming 6.7 service release: #25627


    Verified with the packages built from #25627 (Uno 6.7.171-g7ed29fb1b9), on a new 6.7.30 template app (desktop, Debug):

    Uno.Sdk 6.7.30 With the backport
    Visual Studio 2026, "Suppress JIT optimization" checked the debugger stops on the exception, and the app content never shows no exception
    Rider 2026.2.3.1, default settings button state changes throw no exception
    Rider 2026.3 EAP 7, default settings throws at startup and on button state changes no exception
    Windows and macOS, DOTNET_JITMinOpts=1 throws no exception

    A unit test now checks for this, so it can't come back unnoticed:

  3. removed
    triage/untriaged
    on Oct 22, 2026
  4. self-assigned this
    on Oct 22, 2026
  5. linked a pull request that will close this issuechore: use Mono.Cecil 0.11.6 #24050on Oct 22, 2026
  6. agneszitte commented on Nov 12, 2026

    @agneszitte
    MemberAuthor

    Fixed in Uno.WinUI 6.7.359 and later by the backport #25627, so it ships in Uno.Sdk 6.7.45 (6.7 SR3) and 6.7.49 (6.7 SR4). Update to the latest 6.7 Uno.Sdk to get it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugplatform/desktop 🖥️

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions