Skip to content

The component crashes in MAUI with unsupported platforms #136

@erossini

Description

@erossini

Describe the bug
In my MAUI projects, I have all the platforms (Windows, iOS, Android, MacCatalyst). When I run the application for MacCatalyst, the application crashes. I have to create a different project for it.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NotImplementedException: This functionality is not implemented in the portable version of this assembly.  You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.
  at at Plugin.MauiMTAdmob.CrossMauiMTAdmob.get_Current()
  at MauiAdMob.MainPage..ctor() in /Users/enrico/Projects/MauiAdMob/MauiAdMob/MainPage.xaml.cs:14
  at at System.Reflection.ConstructorInvoker.InterpretedInvoke(Object obj, Span`1 args, BindingFlags invokeAttr)
  --- End of inner exception stack trace ---
  at at System.RuntimeType.CreateInstanceMono(Boolean nonPublic, Boolean wrapExceptions)
  at at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
  at at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
  at at System.Activator.CreateInstance(Type type, Boolean nonPublic)
  at at System.Activator.CreateInstance(Type type)
  at at Microsoft.Maui.Controls.ShellContent.<>c__DisplayClass19_0.<Microsoft.Maui.Controls.IShellContentController.GetOrCreateContent>b__0()
  at at Microsoft.Maui.Controls.ElementTemplate.CreateContent()
  at at Microsoft.Maui.Controls.Internals.DataTemplateExtensions.CreateContent(DataTemplate self, Object item, BindableObject container)
  at at Microsoft.Maui.Controls.ShellContent.Microsoft.Maui.Controls.IShellContentController.GetOrCreateContent()
  at at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.LoadRenderers()
  at at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.ViewDidLoad()
  at at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName)
  at at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass)
  at MauiAdMob.Program.Main(String[] args) in /Users/enrico/Projects/MauiAdMob/MauiAdMob/Platforms/MacCatalyst/Program.cs:13
Screenshot 2023-07-05 at 09 16 51

Should it be possible to fix this issue, so I can have only one project for everything?

Thank you in advance.
Enrico

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions