MAUI .NET 8 on iOS - throwing an exception

 

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(17.4) simulator with Jetbrains Rider, which threw the exception below, 

This issue is happening only on Rider, when running the same code in Visual Studio it is working properly.

  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?

 

 

 

 

0
1 comment

Hello Sysadmin ,

Thank you for reaching Rider Forum. 

Since the issue is not reproduced in the Visual Studio, could you please match the MSBuild version in Settings | Build, Execution, Deployment | Toolset and Build?Try tweaking it or matching with the Visual Studio's one. 

Please let me know if that helps. 

0

Please sign in to leave a comment.