From 9b4fc3d484b7bbb3974e5f1b8054d6146920c8a7 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sun, 23 Oct 2022 17:33:55 -0400 Subject: [PATCH] Fix tests --- .../XamlIl/Runtime/XamlIlRuntimeHelpers.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Markup/Avalonia.Markup.Xaml/XamlIl/Runtime/XamlIlRuntimeHelpers.cs b/src/Markup/Avalonia.Markup.Xaml/XamlIl/Runtime/XamlIlRuntimeHelpers.cs index 307896f3ee..d7bdfa14d0 100644 --- a/src/Markup/Avalonia.Markup.Xaml/XamlIl/Runtime/XamlIlRuntimeHelpers.cs +++ b/src/Markup/Avalonia.Markup.Xaml/XamlIl/Runtime/XamlIlRuntimeHelpers.cs @@ -176,7 +176,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.Runtime public RootServiceProvider(INameScope nameScope) { _nameScope = nameScope; - _runtimePlatform = AvaloniaLocator.Current.GetRequiredService(); + _runtimePlatform = AvaloniaLocator.Current.GetService(); } public object GetService(Type serviceType) @@ -186,7 +186,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.Runtime if (serviceType == typeof(IAvaloniaXamlIlParentStackProvider)) return this; if (serviceType == typeof(IRuntimePlatform)) - return _runtimePlatform; + return _runtimePlatform ?? throw new KeyNotFoundException($"{nameof(IRuntimePlatform)} was not registered"); return null; }