Repository navigation
Closed
Closed
6.7 desktop apps break under the debugger: "The field is invalid for initializing array or span"#25626
#24050 (+2)
Copy link
Labels
Description
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
- Create an app with Uno.Sdk 6.7.30:
dotnet new unoapp -o DebugRepro -preset recommended -platforms desktop - 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.
- 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
- Also reported in BUTTON no longer respond to click in debug #23501.
ColorHelper.ToDisplayName(ColorPicker color names) throws the same exception under the same conditions.- Not affected: the Uno.Sdk 6.8 and 7.0 dev builds.
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
agneszitte commentedon Oct 21, 2026
This is already fixed on
master(and in the 6.8 dev builds) by #24050.A backport to
release/stable/6.7is in progress for the next upcoming 6.7 service release: #25627Verified with the packages built from #25627 (Uno 6.7.171-g7ed29fb1b9), on a new 6.7.30 template app (desktop, Debug):
DOTNET_JITMinOpts=1A unit test now checks for this, so it can't come back unnoticed:
agneszitte commentedon Nov 12, 2026
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.