MAUI .NET 8 on iOS - throwing an exception

Aneetha 65 Reputation points
2024-06-27T05:34:07.4666667+00:00

I have created a new MAUI .NET 8 project and migrated the Xamarin forms project code. When tried to run the project with the iOS simulator with Jetbrains Rider, which threw the exception below,

  1. 2024-06-26 18:04:18.531738+0530 SKM_MOBILE[13228:278431] Could not register the assembly 'Microsoft.Maui.Controls': System.TypeLoadException: Could not resolve type with token 010000c8 from typeref (expected class 'Microsoft.Maui.Graphics.Platform.PlatformGraphicsView' in assembly 'Microsoft.Maui.Graphics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null')    at System.Reflection.RuntimeModule.GetTypes()    at System.Reflection.Assembly.GetTypes()    at Registrar.DynamicRegistrar.CollectTypes(Assembly assembly) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/DynamicRegistrar.cs:line 219    at Registrar.Registrar.RegisterAssembly(Assembly assembly) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Registrar.cs:line 2527 2024-06-26 18:04:18.546774+0530 SKM_MOBILE[13228:278431] Could not register the assembly 'Microsoft.Maui': System.TypeLoadException: Could not resolve type with token 010000c8 from typeref (expected class 'Microsoft.Maui.Graphics.Platform.PlatformGraphicsView' in assembly 'Microsoft.Maui.Graphics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null')    at System.Reflection.RuntimeModule.GetTypes()    at System.Reflection.Assembly.GetTypes()    at Registrar.DynamicRegistrar.CollectTypes(Assembly assembly) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/DynamicRegistrar.cs:line 219    at Registrar.Registrar.RegisterAssembly(Assembly assembly) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Registrar.cs:line 2527 2. Unhandled Exception: System.TypeInitializationException: The type initializer for 'Microsoft.Maui.Controls.Shapes.Shape' threw an exception.  ---> System.MissingFieldException: Field not found: Microsoft.Maui.IPropertyMapper2<Microsoft.Maui.IShapeView, Microsoft.Maui.Handlers.IShapeViewHandler> Microsoft.Maui.Handlers.ShapeViewHandler.Mapper Due to: Could not find field in class    --- End of inner exception stack trace ---    at Microsoft.Maui.Controls.Hosting.AppHostBuilderExtensions.RemapForControls(MauiAppBuilder builder)    at Microsoft.Maui.Controls.Hosting.AppHostBuilderExtensions.SetupDefaults(MauiAppBuilder builder)    at Microsoft.Maui.Controls.Hosting.AppHostBuilderExtensions.UseMauiApp[App](MauiAppBuilder builder)    at SKM_MOBILE.MauiProgram.CreateMauiApp() in /Users/macmini3/Documents/MAUI/SKM_MOBILE/SKM_MOBILE/MauiProgram.cs:line 10    at SKM_MOBILE.AppDelegate.CreateMauiApp() in /Users/macmini3/Documents/MAUI/SKM_MOBILE/SKM_MOBILE/Platforms/iOS/AppDelegate.cs:line 16    at Microsoft.Maui.MauiUIApplicationDelegate.WillFinishLaunching(UIApplication application, NSDictionary launchOptions)    at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 58    at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 94    at SKM_MOBILE.Program.Main(String[] args) in /Users/macmini3/Documents/MAUI/SKM_MOBILE/SKM_MOBILE/Platforms/iOS/Program.cs:line 21 2024-06-26 18:04:45.050897+0530 SKM_MOBILE[13228:278431] Unhandled managed exception: The type initializer for 'Microsoft.Maui.Controls.Shapes.Shape' threw an exception. (System.TypeInitializationException)    at Microsoft.Maui.Controls.Hosting.AppHostBuilderExtensions.RemapForControls(MauiAppBuilder builder)    at Microsoft.Maui.Controls.Hosting.AppHostBuilderExtensions.SetupDefaults(MauiAppBuilder builder)    at Microsoft.Maui.Controls.Hosting.AppHostBuilderExtensions.UseMauiApp[App](MauiAppBuilder builder)    at SKM_MOBILE.MauiProgram.CreateMauiApp() in /Users/macmini3/Documents/MAUI/SKM_MOBILE/SKM_MOBILE/MauiProgram.cs:line 10    at SKM_MOBILE.AppDelegate.CreateMauiApp() in /Users/macmini3/Documents/MAUI/SKM_MOBILE/SKM_MOBILE/Platforms/iOS/AppDelegate.cs:line 16    at Microsoft.Maui.MauiUIApplicationDelegate.WillFinishLaunching(UIApplication application, NSDictionary launchOptions)    at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 58    at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 94    at SKM_MOBILE.Program.Main(String[] args) in /Users/macmini3/Documents/MAUI/SKM_MOBILE/SKM_MOBILE/Platforms/iOS/Program.cs:line 21 Field not found: Microsoft.Maui.IPropertyMapper2<Microsoft.Maui.IShapeView, Microsoft.Maui.Handlers.IShapeViewHandler> Microsoft.Maui.Handlers.ShapeViewHandler.Mapper Due to: Could not find field in class (System.MissingFieldException)

is there any solution to resolve this issue?

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,578 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Aneetha 65 Reputation points
    2024-07-01T12:07:44.52+00:00
    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.