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

Exception in InitializeComponent() Application's method #74

Open
Miamy opened this issue Feb 4, 2022 · 2 comments
Open

Exception in InitializeComponent() Application's method #74

Miamy opened this issue Feb 4, 2022 · 2 comments

Comments

@Miamy
Copy link

Miamy commented Feb 4, 2022

In my test module I have:

     [SetUp]
     public void Setup()
     {
            MockForms.Init();
            Application.Current = new App();
     }

and in App.xaml.cs I have:

     protected override async void OnInitialized()
        {
            InitializeComponent(); <-- Exception throws here
           ...
        }

During executing the exception is raised:
An unhandled exception of type 'System.FieldAccessException' occurred in System.Private.CoreLib.dll
Attempt by method 'MyApp.App.InitializeComponent()' to access field 'Xamarin.Forms.FontElement.FontFamilyProperty

I'm using XF 5.0.0.2337 and Xamarin.Forms.Mocks 4.7.0.1. The Prism fraimwork is used (I don't know if this is important)

@jonathanpeppers
Copy link
Owner

Are you able to make an example test that fails in the same way?

We could add one to the tests here:

https://github.com/jonathanpeppers/Xamarin.Forms.Mocks/blob/master/Xamarin.Forms.Mocks.Tests/ApplicationTests.cs

@Miamy
Copy link
Author

Miamy commented Feb 7, 2022

Unfortunately, I couldn't reproduce this issue on the test project. Maybe, it caused by some third-party package. I'll let you know if some new info will appear.

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

2 participants