using System; using System.Collections.Generic; using Avalonia.UnitTests; using Xunit; namespace Avalonia.Markup.Xaml.UnitTests { public class StyleIncludeTests : XamlTestBase { [Fact] public void Missing_ResourceKey_In_StyleInclude_Does_Not_Cause_StackOverflow() { var styleXaml = @" "; using (StartWithResources(("test:style.xaml", styleXaml))) { var xaml = @" "; var app = Application.Current; try { AvaloniaRuntimeXamlLoader.Load(xaml, null, app); } catch (KeyNotFoundException) { } } } private IDisposable StartWithResources(params (string, string)[] assets) { var assetLoader = new MockAssetLoader(assets); var services = new TestServices(assetLoader: assetLoader); return UnitTestApplication.Start(services); } } }