AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.35k stars 2.2k forks source link

Missing TemplatePart causes window freeze instead of exception #13200

Closed stevemonaco closed 11 months ago

stevemonaco commented 11 months ago

Describe the bug

When creating a ControlTemplate and forgetting some required TemplateParts, the window will freeze if the broken control is loaded sometime after startup. Behind a TabItem that needs to be clicked after startup in this case. Seemed to freeze the Previewer in Rider, too, but I didn't investigate in-depth.

When the broken control is loaded while starting, a KeyNotFoundException immediately closes the program.

To Reproduce

Clone this repo

Run. Click the "Crash" tab. Window should be unresponsive until you try to resize it. Then it will crash.

Expected behavior

I expect a crash/exception immediately after clicking the tab instead of a window freeze.

Environment

maxkatz6 commented 11 months ago

Most likely is going to be fixed by this PR https://github.com/AvaloniaUI/Avalonia/pull/13189

stevemonaco commented 11 months ago

Can confirm fixed by that PR. Can close this issue when it gets merged.

timunie commented 11 months ago

added to the fixes list