Search code examples
c#androiddebuggingxamarinxamarin.android

Error when debugging Xamarin Project on Android Exception: "Default constructor not found for type "[MyApp].Views.AboutPage"


Im getting an error when trying to Debug/Deploy my App (that works on UWP) to Android. I have tried to run the App on the emulator in VS (Android 9) and my smartphone (Android12).

The error i am getting is "Default constructor not found on type [MyApp].Views.AboutPage".

The AboutPage class:

public partial class AboutPage : ContentPage
      {
         public AboutPage()
         {
             InitializeComponent();
             BindingContext = new AboutViewModel();
         }
     }

As in this class, I do not have any non default constructors in my entire Application.

I have already tried to set the linker setting to "Sdk Assemblies only", which resulted in a different error. When trying to debug a Microsoft-Default project on my smartphone it worked with the same settings as in my app. The contents of the AboutPage class do not differ between these two projects.


Solution

  • The exception was caused by a DependencyService, removed it and it worked.