maui: Cannot create native types when deployment is executed to iPhone from VS for Windows without pairing to MAC

Description

Our customers encounter serious issues when directly deploy a MAUI app to iPhone from Visual Studio for Windows (without pair to Mac).

Any application with DevExpress Maui packages fails when it is deployed this way. The following error is shown:

[0:] An error occurred: 'Could not create an native instance of the type 'DevExpress.Navigation.iOS.DXTabControlUIView': the native class hasn't been loaded.
It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.'. Callstack: '   at Foundation.NSObject.InitializeObject(Boolean alloced)
   at Foundation.NSObject..ctor(NSObjectFlag x)
   at UIKit.UIResponder..ctor(NSObjectFlag t)
   at UIKit.UIView..ctor(NSObjectFlag t)
   at DevExpress.Navigation.iOS.DXTabControlUIView..ctor()
   at DevExpress.Maui.Controls.TabViewHandler.CreatePlatformView()
   at Microsoft.Maui.Handlers.ViewHandler`2[[DevExpress.Maui.Controls.TabView, DevExpress.Maui.Controls, Version=22.1.4.0, Culture=neutral, PublicKeyToken=null],[DevExpress.Navigation.iOS.DXTabControlUIView, DevExpress.Maui.iOS.Navigation, Version=22.2.1.0, Culture=neutral, PublicKeyToken=null]].OnCreatePlatformView()
   at Microsoft.Maui.Handlers.ViewHandler.OnCreatePlatformElement()
   at Microsoft.Maui.Handlers.ElementHandler.CreatePlatformElement()
   at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view)
   at Microsoft.Maui.Handlers.ViewHandler`2[[DevExpress.Maui.Controls.TabView, DevExpress.Maui.Controls, Version=22.1.4.0, Culture=neutral, PublicKeyToken=null],[DevExpress.Navigation.iOS.DXTabControlUIView, DevExpress.Maui.iOS.Navigation, Version=22.2.1.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IView view)
   at Microsoft.Maui.Handlers.ViewHandler`2[[DevExpress.Maui.Controls.TabView, DevExpress.Maui.Controls, Version=22.1.4.0, Culture=neutral, PublicKeyToken=null],[DevExpress.Navigation.iOS.DXTabControlUIView, DevExpress.Maui.iOS.Navigation, Version=22.2.1.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view)
   at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
   at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value)
   at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value)
   at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
   at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
   at Microsoft.Maui.Handlers.ContentViewHandler.UpdateContent(IContentViewHandler handler)
   at Microsoft.Maui.Handlers.ContentViewHandler.MapContent(IContentViewHandler handler, IContentView page)
   at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0[[Microsoft.Maui.IContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Handlers.IContentViewHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<Add>b__0(IElementHandler h, IElement v)
   at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView)
   at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView)
   at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view)
   at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.ContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IView view)
   at Microsoft.Maui.Handlers.ContentViewHandler.SetVirtualView(IView view)
   at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.ContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view)
   at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
   at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value)
   at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value)
   at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
   at Microsoft.Maui.Platform.ViewExtensions.ToHandler(IView view, IMauiContext context)
   at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.SetPageRenderer(Page page, ShellContent shellContent)
   at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.LoadRenderers()
   at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.ViewDidLoad()
   at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName)
   at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass)
   at NugetsMauiApp.Program.Main(String[] args) in C:\downloads\FLD_0.zip046\NugetsMauiApp\NugetsMauiApp\NugetsMauiApp\Platforms\iOS\Program.cs:line 13
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)'

When we pair Visual Studio to Mac, the issue does not occur. We also see that everything works correctly when we deploy from a Mac machine.


We researched this issue and found out that our Native libraries were not copied to the Frameworks folder in obj and bin:

image

image


I attached a simple sample with all the required local nuget packages. I also attached a short screencast illustrating the steps to replicate this behavior. The repository is available from this link: https://github.com/AndreyMarten/direct-deployment-to-iphone-error.

sample.zip https://user-images.githubusercontent.com/31204429/196892501-3022bc2a-f13c-4151-a7f8-f34016a57a5b.mp4

Steps to Reproduce

  1. Unpack the attached project (sample.zip) or download the project from the corresponding repository. Open the application in VS for Windows;
  2. Define settings in your Visual Studio:
    1. Unpair your Visual Studio from MAC (if it is already paired);
    2. Add a local iPhone device;
    3. Select the local device as a target one.
  3. Build the application;
  4. Try to deploy and run the application on the target local device;

Visual Studio’s output window will show the error that I illustrated above. See these steps in the screencast I attached earlier (https://user-images.githubusercontent.com/31204429/196892501-3022bc2a-f13c-4151-a7f8-f34016a57a5b.mp4)

Link to public reproduction project repository

https://github.com/AndreyMarten/direct-deployment-to-iphone-error

Version with bug

7.0 Release Candidate 2

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 15

Did you find any workaround?

No response

Relevant log output

Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/Microsoft.iOS.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Runtime.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Collections.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Runtime.InteropServices.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Threading.Thread.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Threading.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Net.Http.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Net.Primitives.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Numerics.Vectors.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Net.Sockets.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Drawing.Primitives.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Private.Uri.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/Xamarin.PreBuilt.iOS.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/Xamarin.iOS.HotRestart.Application.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/netstandard.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.IO.MemoryMappedFiles.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.IO.Pipes.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Memory.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Diagnostics.Tracing.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Collections.NonGeneric.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/Microsoft.Win32.Primitives.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Net.NameResolution.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Threading.ThreadPool.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Runtime.CompilerServices.Unsafe.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Collections.Concurrent.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Runtime.InteropServices.RuntimeInformation.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Diagnostics.Process.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.ComponentModel.Primitives.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.ComponentModel.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.ObjectModel.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Diagnostics.FileVersionInfo.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Reflection.Metadata.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Collections.Immutable.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Linq.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.IO.Compression.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Text.Encoding.Extensions.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Collections.Specialized.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Security.Cryptography.X509Certificates.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Security.Cryptography.Algorithms.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Security.Cryptography.Primitives.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Formats.Asn1.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Runtime.Numerics.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Security.Cryptography.Encoding.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.ComponentModel.TypeConverter.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Runtime.Loader.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Net.Security.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Security.Claims.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Text.RegularExpressions.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Reflection.Emit.ILGeneration.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Reflection.Emit.Lightweight.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Reflection.Primitives.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Runtime.Serialization.Formatters.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Resources.Writer.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Xml.XDocument.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Private.Xml.Linq.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Private.Xml.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Diagnostics.TraceSource.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Diagnostics.DiagnosticSource.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Net.Quic.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.IO.Compression.Brotli.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Threading.Channels.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Net.NetworkInformation.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Reflection.Emit.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Linq.Expressions.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.ComponentModel.EventBasedAsync.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Console.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Data.Common.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Xml.ReaderWriter.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Xml.XmlSerializer.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Transactions.Local.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Diagnostics.Contracts.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Diagnostics.TextWriterTraceListener.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Diagnostics.StackTrace.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.IO.Compression.ZipFile.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.IO.FileSystem.DriveInfo.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.IO.FileSystem.Watcher.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.IO.IsolatedStorage.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Linq.Queryable.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Linq.Parallel.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Net.Requests.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Net.WebHeaderCollection.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Net.ServicePoint.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Net.HttpListener.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Net.WebSockets.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Security.Principal.Windows.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Net.WebClient.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Net.WebProxy.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Net.Mail.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Net.Ping.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Net.WebSockets.Client.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Reflection.DispatchProxy.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Runtime.CompilerServices.VisualC.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Runtime.Serialization.Primitives.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Runtime.Serialization.Xml.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Private.DataContractSerialization.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Runtime.Serialization.Json.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Security.Cryptography.Csp.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Threading.Overlapped.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Threading.Tasks.Parallel.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Web.HttpUtility.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Xml.XPath.XDocument.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Xml.XPath.dll [External]
Thread started:  #2
Thread started: .NET Timers #3
2022-10-20 12:15:48.938 Xamarin.PreBuilt.iOS[2645:170562] Content folder: /var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content

2022-10-20 12:15:48.939 Xamarin.PreBuilt.iOS[2645:170562] App path /var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/NugetsMauiApp.dll

Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/NugetsMauiApp.dll
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/Microsoft.Maui.Controls.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/Microsoft.Maui.dll [External]
2022-10-20 12:15:49.033 Xamarin.PreBuilt.iOS[2645:170562] AppDelegate name: AppDelegate

Thread started: <Thread Pool> #4
Thread started: .NET ThreadPool Gate #5
Thread started: <Thread Pool> #6
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/DevExpress.Maui.Scheduler.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/Microsoft.Maui.Graphics.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/DevExpress.Maui.Core.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/DevExpress.Maui.iOS.Scheduler.dll [External]
Thread started: <Thread Pool> #7
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/Microsoft.Maui.Controls.Compatibility.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/DevExpress.Maui.iOS.Editors.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/DevExpress.Maui.iOS.CollectionView.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/DevExpress.Maui.Controls.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/DevExpress.Maui.iOS.Navigation.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/Microsoft.Extensions.DependencyInjection.Abstractions.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/Microsoft.Extensions.Logging.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/Microsoft.Extensions.Logging.Abstractions.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/Microsoft.Extensions.Options.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/Microsoft.Maui.Controls.Xaml.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/DevExpress.Maui.iOS.Grid.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/DevExpress.Maui.DataGrid.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/DevExpress.Maui.Editors.dll [External]
Thread started: <Thread Pool> #8
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/Microsoft.Extensions.Configuration.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/Microsoft.Extensions.Configuration.Abstractions.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/Microsoft.Extensions.Primitives.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/Microsoft.Extensions.Logging.Debug.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/Microsoft.Maui.Essentials.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/DevExpress.Maui.CollectionView.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/Microsoft.Extensions.DependencyInjection.dll [External]
Resolved pending breakpoint for 'NugetsMauiApp.Program.Main(System.String[])' to C:\downloads\FLD_0.zip048\direct-deployment-to-iphone-error-main\NugetsMauiApp\Platforms\iOS\Program.cs:10 [0x00000].
Loaded assembly: data-0x1357ac000 [External]
Loaded assembly: data-0x1357c0000 [External]
2022-10-20 12:15:50.116 Xamarin.PreBuilt.iOS[2645:170562] Could not resolve assembly Microsoft.VisualStudio.DesignTools.TapContract, Version=17.0.0.0, Culture=neutral, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/Microsoft.VisualStudio.DesignTools.TapContract.dll' or one of its dependencies.

2022-10-20 12:15:50.121 Xamarin.PreBuilt.iOS[2645:170562] Could not resolve assembly Xamarin.HotReload.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/Xamarin.HotReload.Contracts.dll' or one of its dependencies.

Resolved pending breakpoint for 'Xamarin.HotReload.HotReloadAgent.BreakpointSendToIde(System.String)' to D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:423 [0x00000].
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Text.Json.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/17436CE4-6EE0-4914-9E23-4DFEB7F969E9/NugetsMauiApp.app/System.Text.Encodings.Web.dll [External]
2022-10-20 12:15:50.297 Xamarin.PreBuilt.iOS[2645:170562] Could not resolve assembly Xamarin.HotReload.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/Xamarin.HotReload.Contracts.dll' or one of its dependencies.

2022-10-20 12:15:50.299 Xamarin.PreBuilt.iOS[2645:170562] Could not resolve assembly Microsoft.VisualStudio.DesignTools.TapContract, Version=17.0.0.0, Culture=neutral, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/Microsoft.VisualStudio.DesignTools.TapContract.dll' or one of its dependencies.

Resolved pending breakpoint for 'Xamarin.HotReload.HotReloadAgent.BreakpointCheckpoint()' to D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:418 [0x00000].
Thread started:  #9
Thread started:  #10
Thread started:  #11
2022-10-20 12:15:50.959 Xamarin.PreBuilt.iOS[2645:170562] Could not resolve assembly System.Private.DataContractSerialization.resources, Version=6.0.0.0, Culture=en-UA, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/System.Private.DataContractSerialization.resources.dll' or one of its dependencies.

2022-10-20 12:15:50.961 Xamarin.PreBuilt.iOS[2645:170562] Could not resolve assembly System.Private.DataContractSerialization.resources, Version=6.0.0.0, Culture=en, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/System.Private.DataContractSerialization.resources.dll' or one of its dependencies.

[0:] Microsoft.Maui.Controls.BindableObject: Warning: Cannot convert 7 to type 'System.Single'
2022-10-20 12:15:52.043 Xamarin.PreBuilt.iOS[2645:170562] Could not resolve assembly DevExpress.Maui.Scheduler.resources, Version=22.1.4.0, Culture=en-UA, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/DevExpress.Maui.Scheduler.resources.dll' or one of its dependencies.

2022-10-20 12:15:52.045 Xamarin.PreBuilt.iOS[2645:170562] Could not resolve assembly DevExpress.Maui.Scheduler.resources, Version=22.1.4.0, Culture=en, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/467AC82B-56DD-44D2-A5AB-215DFAA972B5/Documents/NugetsMauiApp.content/DevExpress.Maui.Scheduler.resources.dll' or one of its dependencies.

[0:] An error occurred: 'Could not create an native instance of the type 'DevExpress.Navigation.iOS.DXTabControlUIView': the native class hasn't been loaded.
It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.'. Callstack: '   at Foundation.NSObject.InitializeObject(Boolean alloced)
   at Foundation.NSObject..ctor(NSObjectFlag x)
   at UIKit.UIResponder..ctor(NSObjectFlag t)
   at UIKit.UIView..ctor(NSObjectFlag t)
   at DevExpress.Navigation.iOS.DXTabControlUIView..ctor()
   at DevExpress.Maui.Controls.TabViewHandler.CreatePlatformView()
   at Microsoft.Maui.Handlers.ViewHandler`2[[DevExpress.Maui.Controls.TabView, DevExpress.Maui.Controls, Version=22.1.4.0, Culture=neutral, PublicKeyToken=null],[DevExpress.Navigation.iOS.DXTabControlUIView, DevExpress.Maui.iOS.Navigation, Version=22.2.1.0, Culture=neutral, PublicKeyToken=null]].OnCreatePlatformView()
   at Microsoft.Maui.Handlers.ViewHandler.OnCreatePlatformElement()
   at Microsoft.Maui.Handlers.ElementHandler.CreatePlatformElement()
   at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view)
   at Microsoft.Maui.Handlers.ViewHandler`2[[DevExpress.Maui.Controls.TabView, DevExpress.Maui.Controls, Version=22.1.4.0, Culture=neutral, PublicKeyToken=null],[DevExpress.Navigation.iOS.DXTabControlUIView, DevExpress.Maui.iOS.Navigation, Version=22.2.1.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IView view)
   at Microsoft.Maui.Handlers.ViewHandler`2[[DevExpress.Maui.Controls.TabView, DevExpress.Maui.Controls, Version=22.1.4.0, Culture=neutral, PublicKeyToken=null],[DevExpress.Navigation.iOS.DXTabControlUIView, DevExpress.Maui.iOS.Navigation, Version=22.2.1.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view)
   at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
   at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value)
   at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value)
   at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
   at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement view, IMauiContext context)
   at Microsoft.Maui.Handlers.ContentViewHandler.UpdateContent(IContentViewHandler handler)
   at Microsoft.Maui.Handlers.ContentViewHandler.MapContent(IContentViewHandler handler, IContentView page)
   at Microsoft.Maui.PropertyMapper`2.<>c__DisplayClass5_0[[Microsoft.Maui.IContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Handlers.IContentViewHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<Add>b__0(IElementHandler h, IElement v)
   at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView)
   at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView)
   at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view)
   at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.ContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IView view)
   at Microsoft.Maui.Handlers.ContentViewHandler.SetVirtualView(IView view)
   at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.ContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view)
   at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
   at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value)
   at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value)
   at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
   at Microsoft.Maui.Platform.ViewExtensions.ToHandler(IView view, IMauiContext context)
   at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.SetPageRenderer(Page page, ShellContent shellContent)
   at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.LoadRenderers()
   at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.ViewDidLoad()
   at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName)
   at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass)
   at NugetsMauiApp.Program.Main(String[] args) in C:\downloads\FLD_0.zip048\direct-deployment-to-iphone-error-main\NugetsMauiApp\Platforms\iOS\Program.cs:line 13
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)'
The app has been terminated.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21 (11 by maintainers)

Most upvoted comments

I’ve figured out the issue. The _UnpackHotRestartFrameworkAssemblies target is assuming that framework files will be found as embedded resources in assemblies. When brought in via NuGet packages, they’re not. They’re either in a folder or zip file within the NuGet package itself.

I created a target that works around this problem. Put it in the .csproj of the app that’s being built with Hot Restart and everything should work. I tested with nugets having either regular framework or xcframework.

https://gist.github.com/mattjohnsonpint/37d3ac06a563c41618fc933bf7282d66

@rolfbjarne - This (or something like it) probably belongs directly in Xamarin.iOS.HotRestart.targets. Should I open an issue and/or PR on the xamarin-macios repository?

It should work if added anywhere within the <Project></Project>. I usually put custom targets towards the end.

I’ve also submitted a similar fix to Microsoft in https://github.com/xamarin/xamarin-macios/pull/16605 - so hopefully the workaround is temporary, depending on when that gets released.

@mattjohnsonpint I’ve created an issue in xamarin-macios: https://github.com/xamarin/xamarin-macios/issues/16571.

A PR would be very welcome!

Regarding your fix: have in mind that the bound framework is usually zipped if it contains symlinks, and since symlinks won’t work correctly on Windows, a complete fix should probably detect zips with symlinks and show an error in that case (symlinks are most common in macOS and Mac Catalyst frameworks, so it shouldn’t be a common problem for mobile platforms, although there’s nothing stopping a framework vendor from doing it).

We are having the exact same issue with the Sentry .NET SDK for net6.0-ios targets (with or without MAUI). See https://github.com/getsentry/sentry-dotnet/issues/1961

@AndreyMarten - I upvoted and added comments to the issue you created. Thank you!