xaml-csharp-development-skill-for-avalonia

Troubleshooting

Fast Triage Order

  1. Confirm lifetime branch (Desktop, SingleView, Activity) executes as expected.
  2. Confirm precompiled XAML/resources are included correctly.
  3. Confirm binding style (CompiledBinding vs reflection binding) and x:DataType contracts.
  4. Confirm UI-thread access for control updates.
  5. Confirm platform backend options and rendering fallbacks.

Symptom Matrix

1) “No precompiled XAML found for …”

Likely causes:

Fixes:

2) Binding works in Debug but fails in trimmed/AOT publish

Likely causes:

Fixes:

3) UI updates throw cross-thread exceptions or behave inconsistently

Likely causes:

Fixes:

4) Dialog/file-picker behavior differs by platform

Likely causes:

Fixes:

5) Window close/shutdown behavior is incorrect

Likely causes:

Fixes:

6) Theme changes do not propagate as expected

Likely causes:

Fixes:

7) Startup fails only on one backend (Win32/X11/Browser/etc.)

Likely causes:

Fixes:

8) Data templates not applied or type mismatch exceptions

Likely causes:

Fixes:

Binding Diagnostics Tips

Publish Validation Tips

XAML-First and Code-Only Usage

Default mode:

XAML-first references:

XAML-first minimal repro:

<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:vm="using:MyApp.ViewModels"
             x:DataType="vm:LoginViewModel">
  <TextBox Text="{CompiledBinding UserName}" />
</UserControl>

Code-only minimal repro (on request):

var textBox = new TextBox();
textBox.Bind(TextBox.TextProperty, new Binding(nameof(LoginViewModel.UserName)));