Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Get a font exception if not in Navigation page

EliranEliran USMember ✭✭✭

I had a Xamarin.Forms application which had a tool bar, so the MainPage was wrapped with a Navigation page (for having
this tool bar). Everything worked well.

Now, I try to convert this application to be a MasterDetail Page application.
Therefore I don't need the Navigation page (If I use the Navigation Page I will have two toolbars, and I don't want it).

The problem is that when I launch MasterDetailPage not wrapped with a Navigation page (From App.cs)
I get the exception:
" Java.Lang.RuntimeException: 'Font asset not found sans-serif' "
in MainActivity.cs

I've checked in all the solution: I don't use any font with the name 'sans-serif'.

for summary:~~~~
In App.xaml.cs:
MainPage = new NavigationPage(new NiceMasterDetailPage());
doesn't provide any exception.

In App.xaml.cs:
MainPage = new NiceMasterDetailPage();
does provide the exception:
" Java.Lang.RuntimeException: 'Font asset not found sans-serif' "

Does someone can help me understand why?

Answers

  • JoeMankeJoeManke USMember ✭✭✭✭✭

    Do you have a stack trace to go with that exception?

  • EliranEliran USMember ✭✭✭

    @JoeManke Thank you for you response.
    I wanted to give you a stack trace. Therefore I opened VS, Ran the app and...no exception occurs.

    I hate such things, because I will never know what was the problem :/

  • LandLuLandLu Member, Xamarin Team Xamurai

    Please check your project whether you load this font somewhere else.

    I wanted to give you a stack trace. Therefore I opened VS, Ran the app and...no exception occurs.

    Do you mean this issue has been solved?

  • EliranEliran USMember ✭✭✭

    @LandLu Hi thanks for your response.

    Please check your project whether you load this font somewhere else.

    I've search for this string "sans-serif" in all my solution by CTRL+F and didn't find it.

    Do you mean this issue has been solved?

    Well, I don't know if "solved" is the right word. It just doesn't happens anymore. Don't know why.

  • LandLuLandLu Member, Xamarin Team Xamurai

    It just doesn't happens anymore

    Try to stably reproduce it and post the actual exceptions here.

Sign In or Register to comment.