Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty main page content while running on Windows (10.0.19043) #33

Open
Davidoutz opened this issue Jul 29, 2021 · 6 comments
Open

Empty main page content while running on Windows (10.0.19043) #33

Davidoutz opened this issue Jul 29, 2021 · 6 comments

Comments

@Davidoutz
Copy link

Davidoutz commented Jul 29, 2021

I installed all prerequisites for .Net MAUI, the latest VS 2022 (17.0.0 Preview 2.1) and the maui-check. Everything looks good from this perspective and I can create a new maui project and run it on any platform. Nevertheless I've tried to download and run the weather app as is. While it's working fine on android, on windows (10.0.19043) it shows the first page but no content nor the menu/tabbar.

image

I see from the output that it cannot fetch a font for some reasons:

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): Classe non enregistrée (0x80040154 (REGDB_E_CLASSNOTREG))
   at WinRT.BaseActivationFactory..ctor(String typeNamespace, String typeFullName) in Microsoft.Graphics.Canvas.Interop.dll:token 0x6000023+0x6e
   at WinRT.ActivationFactory`1..ctor() in Microsoft.Graphics.Canvas.Interop.dll:token 0x6000027+0x0
   at System.RuntimeType.CreateInstanceOfT() in System.Private.CoreLib.dll:token 0x6000681+0x3e
   --- End of inner exception stack trace ---
   at System.RuntimeType.CreateInstanceOfT() in System.Private.CoreLib.dll:token 0x6000681+0x4e
   at System.Activator.CreateInstance[T]() in System.Private.CoreLib.dll:token 0x60009a4+0x0
   at WinRT.WeakLazy`1.get_Value() in Microsoft.Graphics.Canvas.Interop.dll:token 0x6000019+0x20
   at WinRT.ActivationFactory`1.As(Guid iid) in Microsoft.Graphics.Canvas.Interop.dll:token 0x600002a+0x0
   at Microsoft.Graphics.Canvas.Text.CanvasFontSet._ICanvasFontSetFactory..ctor() in Microsoft.Graphics.Canvas.Interop.dll:token 0x6003792+0x1c
   at System.RuntimeType.CreateInstanceOfT() in System.Private.CoreLib.dll:token 0x6000681+0x3e
   --- End of inner exception stack trace ---
   at System.RuntimeType.CreateInstanceOfT() in System.Private.CoreLib.dll:token 0x6000681+0x4e
   at System.Activator.CreateInstance[T]() in System.Private.CoreLib.dll:token 0x60009a4+0x0
   at WinRT.WeakLazy`1.get_Value() in Microsoft.Graphics.Canvas.Interop.dll:token 0x6000019+0x20
   at Microsoft.Graphics.Canvas.Text.CanvasFontSet._ICanvasFontSetFactory.get_Instance() in Microsoft.Graphics.Canvas.Interop.dll:token 0x6003793+0x0
   at Microsoft.Graphics.Canvas.Text.CanvasFontSet.<>c__DisplayClass8_0.<.ctor>b__0() in Microsoft.Graphics.Canvas.Interop.dll:token 0x60037a2+0x0
   at Microsoft.Graphics.Canvas.Text.CanvasFontSet..ctor(Uri uri) in Microsoft.Graphics.Canvas.Interop.dll:token 0x6001c41+0x1a
   at Microsoft.Maui.FontManager.FindFontFamilyName(String fontFile) in Microsoft.Maui.dll:token 0x60000e0+0x3a
Microsoft.Maui.FontManager: Error: Error loading font 'ms-appx:///Assets/OpenSans-Regular.ttf'.

But even when I remove the fonts I still have the same behavior so I don't think this is related.

Any idea what could I be missing ?

@sinsedrix
Copy link

@Davidoutz I have the same issue. Did you manage to fix it?

@Davidoutz
Copy link
Author

@sinsedrix unfortunately not yet. But somewhat I am happy to see that I am not the only one :)

@mogand
Copy link

mogand commented Aug 1, 2021

I have the same issue

@Fma965
Copy link

Fma965 commented Aug 4, 2021

I'm on windows 11 but have the same issue also.
image

@ziaulhasanhamim
Copy link

Have anyone fixed this problem. is it a problem with maui or winui 3 itself.

@martin-juul
Copy link

To make the fonts load correctly, you have to rename the fontFamily.

Go to Startup.cs and change these lines to fix it:

    .ConfigureFonts(fonts => {
        fonts.AddFont("fa-solid-900.ttf", "FontAwesome");
-       fonts.AddFont("OpenSans-Regular.ttf", "OpenSans-Regular");
+       fonts.AddFont("OpenSans-Regular.ttf", "Open Sans Regular");
-       fonts.AddFont("OpenSans-SemiBold.ttf", "OpenSans-SemiBold");
+       fonts.AddFont("OpenSans-SemiBold.ttf", "Open Sans SemiBold");
    })

A similar issue was confusing many of us with react-native-windows. See microsoft/react-native-windows/issues/652 for reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants