From cc4cfa67ad9d07ef7c91e3a8239a52fc2463e97e Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 30 Nov 2021 09:49:49 +0100 Subject: [PATCH] Throw when interface not supported. --- src/Windows/Avalonia.Win32/Automation/AutomationNode.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Windows/Avalonia.Win32/Automation/AutomationNode.cs b/src/Windows/Avalonia.Win32/Automation/AutomationNode.cs index f2ba875945..70e415aff1 100644 --- a/src/Windows/Avalonia.Win32/Automation/AutomationNode.cs +++ b/src/Windows/Avalonia.Win32/Automation/AutomationNode.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; using System.Runtime.CompilerServices; @@ -223,7 +222,6 @@ namespace Avalonia.Win32.Automation Dispatcher.UIThread.InvokeAsync(action).Wait(); } - [return: MaybeNull] protected T InvokeSync(Func func) { if (Dispatcher.UIThread.CheckAccess()) @@ -245,9 +243,12 @@ namespace Avalonia.Win32.Automation throw new COMException(e.Message, UiaCoreProviderApi.UIA_E_ELEMENTNOTENABLED); } } + else + { + throw new NotSupportedException(); + } } - [return: MaybeNull] protected TResult InvokeSync(Func func) { if (Peer.GetProvider() is TInterface i) @@ -262,7 +263,7 @@ namespace Avalonia.Win32.Automation } } - return default; + throw new NotSupportedException(); } protected void RaiseFocusChanged(AutomationNode? focused)