davidortinau / WeatherTwentyOne

MIT License
927 stars 220 forks source link

Updates for RC1 #37

Closed davidortinau closed 2 years ago

davidortinau commented 3 years ago
MartyIX commented 3 years ago

I wanted to test notifications on Windows but this does not work for me (throws NRE):

ServiceProvider.GetService<INotificationService>()!.ShowNotification("Hello Build! 😻 From .NET MAUI", "How's your weather?  It's sunny where we are 🌞");

This does:

#if WINDOWS
WeatherTwentyOne.WinUI.NotificationService notificationService = new();
notificationService.ShowNotification("Hello Build! 😻 From .NET MAUI", "How's your weather?  It's sunny where we are 🌞");
#endif

So services are not registered, it seems.

MartyIX commented 3 years ago

When running as Windows app, I can see the following error in Output window of VS2022:

Microsoft.Maui.FontManager: Error: Error loading font 'ms-appx:///Assets/OpenSans-SemiBold.ttf'.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.Runtime.InteropServices.COMException (0x80040154): Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
   at WinRT.BaseActivationFactory..ctor(String typeNamespace, String typeFullName)
   at WinRT.ActivationFactory`1..ctor()
   at System.RuntimeType.CreateInstanceOfT()
   --- End of inner exception stack trace ---
   at System.RuntimeType.CreateInstanceOfT()
   at System.Activator.CreateInstance[T]()
   at WinRT.WeakLazy`1.get_Value()
   at WinRT.ActivationFactory`1.As(Guid iid)
   at Microsoft.Graphics.Canvas.Text.CanvasFontSet._ICanvasFontSetFactory..ctor()
   at System.RuntimeType.CreateInstanceOfT()
   --- End of inner exception stack trace ---
   at System.RuntimeType.CreateInstanceOfT()
   at System.Activator.CreateInstance[T]()
   at WinRT.WeakLazy`1.get_Value()
   at Microsoft.Graphics.Canvas.Text.CanvasFontSet._ICanvasFontSetFactory.get_Instance()
   at Microsoft.Graphics.Canvas.Text.CanvasFontSet.<>c__DisplayClass8_0.<.ctor>b__0()
   at Microsoft.Graphics.Canvas.Text.CanvasFontSet..ctor(Uri uri)
   at Microsoft.Maui.FontManager.FindFontFamilyName(String fontFile)