public static async Task <TInterface> GetGlobalServiceFreeThreadedAsync <TService, TInterface>() where TInterface : class { if (PackageServiceProvider != null) { TInterface service = await PackageServiceProvider.GetFreeThreadedServiceAsync <TService, TInterface>(); if (service != null) { return(service); } } return(await AsyncServiceProvider.GlobalProvider.GetServiceAsync <TService, TInterface>()); }