question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Maui.Graphics.Platform.PlatformGraphicsView Token Type Not Resolved

See original GitHub issue

Description

The application is deployed but fails to load the token PlatformGraphicsView within the Microsoft.Maui.Graphic assembly on iOS.

The app under development was previously working before .NET 7 framework upgrade across Maui Project. The error is present when deploying to iOS 16.1 on a direct connected iPhone 11 but not to Windows 11 v21H2 on a PC. _

/private/var/mobile/Containers/Data/Application/14D17C77-1203-43A4-8BAA-5EB9A7C90346/Documents/Sentry.content/Microsoft.Maui.Graphics.dll [External] [0:] An error occurred: ‘Could not resolve type with token 010000b9 from typeref (expected class ‘Microsoft.Maui.Graphics.Platform.PlatformGraphicsView’ in assembly ‘Microsoft.Maui.Graphics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’)’. Callstack: ’ at System.Reflection.RuntimeModule.GetTypes() at System.Reflection.Assembly.GetTypes() at Xamarin.iOS.HotRestart.Application.ForceLoadingAssemblies(Type formsDelegate, String contentFolder) at Xamarin.iOS.HotRestart.Application.Run(String[] args, Action`1 loadFrameworkAction, Action killApplicationAction)’ The app has been terminated.

_ log.txt

Steps to Reproduce

Creating a new MAUI application and adding all the Nugets in the development app and deploying fails to exhibit bug.

Link to public reproduction project repository

NA

Version with bug

7.0 (current)

Last version that worked well

6.0.424

Affected platforms

iOS

Affected platform versions

iOS 16.1

Did you find any workaround?

Revert to .NET 6 and remove calls to Window.MaximumWidth and Window.MaximumHeight which are only supported in .NET 7.

Relevant log output

Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/Microsoft.iOS.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Runtime.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Collections.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Runtime.InteropServices.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Threading.Thread.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Threading.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Net.Http.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Net.Primitives.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Numerics.Vectors.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Net.Sockets.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Drawing.Primitives.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Private.Uri.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/Xamarin.PreBuilt.iOS.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/Xamarin.iOS.HotRestart.Application.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/netstandard.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.IO.MemoryMappedFiles.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.IO.Pipes.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Memory.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Diagnostics.Tracing.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Collections.NonGeneric.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/Microsoft.Win32.Primitives.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Net.NameResolution.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Threading.ThreadPool.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Collections.Concurrent.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Diagnostics.Process.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.ComponentModel.Primitives.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.ComponentModel.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.ObjectModel.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Diagnostics.FileVersionInfo.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Reflection.Metadata.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Collections.Immutable.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Linq.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.IO.Compression.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Text.Encoding.Extensions.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Collections.Specialized.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Security.Cryptography.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Formats.Asn1.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Runtime.Numerics.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.ComponentModel.TypeConverter.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Runtime.Loader.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Text.RegularExpressions.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Reflection.Emit.ILGeneration.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Reflection.Emit.Lightweight.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Reflection.Primitives.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Net.Security.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Security.Claims.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Runtime.Serialization.Formatters.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Resources.Writer.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Xml.XDocument.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Private.Xml.Linq.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Private.Xml.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Diagnostics.TraceSource.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Diagnostics.DiagnosticSource.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Net.Quic.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.IO.Compression.Brotli.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Threading.Channels.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Net.NetworkInformation.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Reflection.Emit.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Linq.Expressions.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.ComponentModel.EventBasedAsync.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Console.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Data.Common.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Xml.ReaderWriter.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Xml.XmlSerializer.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Transactions.Local.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Diagnostics.Contracts.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Diagnostics.TextWriterTraceListener.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Diagnostics.StackTrace.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.IO.Compression.ZipFile.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.IO.FileSystem.DriveInfo.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.IO.FileSystem.Watcher.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.IO.IsolatedStorage.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Linq.Queryable.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Linq.Parallel.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Net.Requests.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Net.WebHeaderCollection.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Net.ServicePoint.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Net.HttpListener.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Net.WebSockets.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Security.Principal.Windows.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Net.WebClient.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Net.WebProxy.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Net.Mail.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Net.Ping.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Net.WebSockets.Client.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Reflection.DispatchProxy.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Runtime.CompilerServices.VisualC.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Runtime.Serialization.Primitives.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Runtime.Serialization.Xml.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Private.DataContractSerialization.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Runtime.Serialization.Json.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Threading.Overlapped.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Threading.Tasks.Parallel.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Web.HttpUtility.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Xml.XPath.XDocument.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Xml.XPath.dll [External]
Thread started:  #2
Thread started: .NET Timer #3
Thread started: <Thread Pool> #4
Thread started: .NET ThreadPool Gate #5
Thread started: <Thread Pool> #6
2022-11-15 17:53:21.908 Xamarin.PreBuilt.iOS[512:39551] Content folder: /var/mobile/Containers/Data/Application/14D17C77-1203-43A4-8BAA-5EB9A7C90346/Documents/Sentry.content

2022-11-15 17:53:21.909 Xamarin.PreBuilt.iOS[512:39551] App path /var/mobile/Containers/Data/Application/14D17C77-1203-43A4-8BAA-5EB9A7C90346/Documents/Sentry.content/Sentry.dll

Loaded assembly: /private/var/mobile/Containers/Data/Application/14D17C77-1203-43A4-8BAA-5EB9A7C90346/Documents/Sentry.content/Sentry.dll
Loaded assembly: /private/var/mobile/Containers/Data/Application/14D17C77-1203-43A4-8BAA-5EB9A7C90346/Documents/Sentry.content/Microsoft.Maui.Controls.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/14D17C77-1203-43A4-8BAA-5EB9A7C90346/Documents/Sentry.content/Microsoft.Data.Services.Client.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/14D17C77-1203-43A4-8BAA-5EB9A7C90346/Documents/Sentry.content/Microsoft.Maui.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/14D17C77-1203-43A4-8BAA-5EB9A7C90346/Documents/Sentry.content/System.ServiceModel.Primitives.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/14D17C77-1203-43A4-8BAA-5EB9A7C90346/Documents/Sentry.content/System.Private.ServiceModel.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/14D17C77-1203-43A4-8BAA-5EB9A7C90346/Documents/Sentry.content/Microsoft.Bcl.AsyncInterfaces.dll [External]
2022-11-15 17:53:22.159 Xamarin.PreBuilt.iOS[512:39551] AppDelegate name: AppDelegate

Loaded assembly: /private/var/mobile/Containers/Data/Application/14D17C77-1203-43A4-8BAA-5EB9A7C90346/Documents/Sentry.content/Microsoft.OData.Edm.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/14D17C77-1203-43A4-8BAA-5EB9A7C90346/Documents/Sentry.content/Microsoft.Data.Edm.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/14D17C77-1203-43A4-8BAA-5EB9A7C90346/Documents/Sentry.content/Microsoft.Data.OData.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/E3F659A9-BA39-4C13-A0A5-013CED0715AB/Sentry.app/System.Reflection.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/14D17C77-1203-43A4-8BAA-5EB9A7C90346/Documents/Sentry.content/System.Security.Cryptography.Xml.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/14D17C77-1203-43A4-8BAA-5EB9A7C90346/Documents/Sentry.content/Inversion.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/14D17C77-1203-43A4-8BAA-5EB9A7C90346/Documents/Sentry.content/Microsoft.Maui.Graphics.dll [External]
[0:] An error occurred: 'Could not resolve type with token 010000b9 from typeref (expected class 'Microsoft.Maui.Graphics.Platform.PlatformGraphicsView' in assembly 'Microsoft.Maui.Graphics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null')'. Callstack: '   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at Xamarin.iOS.HotRestart.Application.ForceLoadingAssemblies(Type formsDelegate, String contentFolder)
   at Xamarin.iOS.HotRestart.Application.Run(String[] args, Action`1 loadFrameworkAction, Action killApplicationAction)'
The app has been terminated.

VS bug #1745740

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Reactions:3
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
JPZVcommented, Nov 30, 2022

It seems like there is an issue when you specify the target iOS. If there is a version specified after net7.0-ios (e.g. net7.0-ios15.4) on your .csproj TargetFrameworks, it’ll crash with that exception. So, the workaround is to just use net7.0-ios instead.

In other words, this .csproj will crash:

<Project Sdk="Microsoft.NET.Sdk">

	<PropertyGroup>
		<TargetFrameworks>net7.0-android;net7.0-maccatalyst;net7.0-ios15.4</TargetFrameworks>
		<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
		<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
		<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
		<OutputType>Exe</OutputType>
		<RootNamespace>Maui_11413</RootNamespace>
		<UseMaui>true</UseMaui>
		<SingleProject>true</SingleProject>
		<ImplicitUsings>enable</ImplicitUsings>
.....

While this will not:

<Project Sdk="Microsoft.NET.Sdk">

	<PropertyGroup>
		<TargetFrameworks>net7.0-android;net7.0-maccatalyst;net7.0-ios</TargetFrameworks>
		<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
		<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
		<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
		<OutputType>Exe</OutputType>
		<RootNamespace>Maui_11413</RootNamespace>
		<UseMaui>true</UseMaui>
		<SingleProject>true</SingleProject>
		<ImplicitUsings>enable</ImplicitUsings>
.....

(Please note that net7.0-ios15.4 has to be replaced by net7.0-ios on every PropertyGroup too)

I’ve attached a repro just in case

Maui_11413.zip

Please remember that you need a signing identity and a Provisioning profile, otherwise it’ll not compile.

1reaction
faheyscommented, Dec 16, 2022

It seems like there is an issue when you specify the target iOS. If there is a version specified after net7.0-ios (e.g. net7.0-ios15.4) on your .csproj TargetFrameworks, it’ll crash with that exception. So, the workaround is to just use net7.0-ios instead.

In other words, this .csproj will crash:

<Project Sdk="Microsoft.NET.Sdk">

	<PropertyGroup>
		<TargetFrameworks>net7.0-android;net7.0-maccatalyst;net7.0-ios15.4</TargetFrameworks>
		<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
		<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
		<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
		<OutputType>Exe</OutputType>
		<RootNamespace>Maui_11413</RootNamespace>
		<UseMaui>true</UseMaui>
		<SingleProject>true</SingleProject>
		<ImplicitUsings>enable</ImplicitUsings>
.....

While this will not:

<Project Sdk="Microsoft.NET.Sdk">

	<PropertyGroup>
		<TargetFrameworks>net7.0-android;net7.0-maccatalyst;net7.0-ios</TargetFrameworks>
		<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
		<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
		<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
		<OutputType>Exe</OutputType>
		<RootNamespace>Maui_11413</RootNamespace>
		<UseMaui>true</UseMaui>
		<SingleProject>true</SingleProject>
		<ImplicitUsings>enable</ImplicitUsings>
.....

(Please note that net7.0-ios15.4 has to be replaced by net7.0-ios on every PropertyGroup too)

I’ve attached a repro just in case

Maui_11413.zip

Please remember that you need a signing identity and a Provisioning profile, otherwise it’ll not compile.

I can confirm that this workaround resolved the issue for me also.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Runtime Error in Net Maui Graphics - Microsoft Q&A
I am trying to apply Maui Graphics but it's not as easy as Skiasharp and System.Drawing, because the drawing class is separate, ...
Read more >
System.TypeLoadException when running Maui.Graphics ...
System.TypeLoadException: 'Could not resolve type with token 010001db from typeref (expected class 'Microsoft.Maui.Graphics.Platform.
Read more >
Cannot resolve type in UI for .NET MAUI
I'm trying to make a line graph so I copied the LineSeriesXaml example from the SDK app exactly into my project, but it...
Read more >
Microsoft.Maui.Platform.HandlerExtensions Excepion using ...
I am facing this exception when i have update my visual studio preview 2.0 to 3.0 "System. Type Load Exception: 'Could not resolve...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found