question

aguella-2168 avatar image
0 Votes"
aguella-2168 asked RobCaplan edited

Can't build and run Xamarin project on physical iOS device

Hey all,

For about the last month I have been unable to successfully build my Xamarin project to a physical iOS device. Simulator works perfectly fine. My project compiles and uploads to the device but then I hit this error:

 2021-04-29 11:57:20.626 mlaunch[29997:2970473] 
 Unhandled Exception:
 Xamarin.Hosting.MobileDeviceException: Invalid Service Error (error: 0xe8000022)
   at Xamarin.Hosting.RealDevice.SecureStartService (System.String service) [0x00086] in /Users/builder/azdo/_work/1/s/maccore/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/RealDevice.cs:620 
   at Xamarin.Hosting.DebugService..ctor (Xamarin.Hosting.RealDevice d) [0x00000] in /Users/builder/azdo/_work/1/s/maccore/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/DebugService.cs:30 
   at Xamarin.Hosting.DebugService+<>c__DisplayClass9_0.<RunWithLldbAsync>b__0 (System.Object v) [0x00019] in /Users/builder/azdo/_work/1/s/maccore/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/DebugService.cs:132 
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_1 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1037 
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x0000d] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1370 
   at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:968 
   at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:910 
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00021] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1341 
   at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:899 
   at ObjCRuntime.Runtime.ThreadPoolDispatcher (System.Func`1[TResult] callback) [0x00007] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:289 
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00009] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1258 
 [ERROR] FATAL UNHANDLED EXCEPTION: Xamarin.Hosting.MobileDeviceException: Invalid Service Error (error: 0xe8000022)
   at Xamarin.Hosting.RealDevice.SecureStartService (System.String service) [0x00086] in /Users/builder/azdo/_work/1/s/maccore/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/RealDevice.cs:620 
   at Xamarin.Hosting.DebugService..ctor (Xamarin.Hosting.RealDevice d) [0x00000] in /Users/builder/azdo/_work/1/s/maccore/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/DebugService.cs:30 
   at Xamarin.Hosting.DebugService+<>c__DisplayClass9_0.<RunWithLldbAsync>b__0 (System.Object v) [0x00019] in /Users/builder/azdo/_work/1/s/maccore/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/DebugService.cs:132 
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_1 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1037 
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x0000d] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1370 
   at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:968 
   at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:910 
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00021] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1341 
   at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:899 
   at ObjCRuntime.Runtime.ThreadPoolDispatcher (System.Func`1[TResult] callback) [0x00007] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:289 
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00009] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1258 

I've tried completely reinstalling Visual Studio, downgrading to versions that work for my teammates, and even building fresh Xamarin projects. I can't figure out what is causing this issue. FWIW I can successfully build and run swift projects on device through Xcode. If I manually launch after receiving this message yes the debugger connects but Apple's On Demand Resources do not work when launched this way and this is crucial for the app I'm developing.

VS details:
=== Visual Studio Community 2019 for Mac ===

 Version 8.9.7 (build 8)
 Installation UUID: 28c662f8-c51b-4063-afe4-d6c1f240184a
     GTK+ 2.24.23 (Raleigh theme)
     Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)
    
     Package version: 612000125
    
 === Mono Framework MDK ===
    
 Runtime:
     Mono 6.12.0.125 (2020-02/8c552e98bd6) (64-bit)
     Package version: 612000125
    
 === Roslyn (Language Service) ===
    
 3.9.0-6.21152.10+c10f884b30737542ddd84ca889a4aad9281ce210
    
 === NuGet ===
    
 Version: 5.8.0.6860
    
 === .NET Core SDK ===
    
 SDK: /usr/local/share/dotnet/sdk/5.0.202/Sdks
 SDK Versions:
     5.0.202
     5.0.102
     3.1.408
     3.1.407
     3.1.406
     3.1.405
     3.1.302
     3.1.301
 MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks
    
 === .NET Core Runtime ===
    
 Runtime: /usr/local/share/dotnet/dotnet
 Runtime Versions:
     5.0.5
     5.0.2
     3.1.14
     3.1.13
     3.1.12
     3.1.11
     3.1.6
     3.1.5
     2.1.23
     2.1.20
     2.1.19
    
 === .NET Core 3.1 SDK ===
    
 SDK: 3.1.408
    
 === Xamarin.Profiler ===
    
 Version: 1.6.15.68
 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
    
 === Updater ===
    
 Version: 11
    
 === Xamarin.Android ===
    
 Version: 11.2.2.1 (Visual Studio Community)
 Commit: xamarin-android/d16-9/877f572
 Android SDK: /Users/aguella/Library/Developer/Xamarin/android-sdk-macosx
     Supported Android versions:
         8.0 (API level 26)
    
 SDK Tools Version: 26.1.1
 SDK Platform Tools Version: 30.0.4
 SDK Build Tools Version: 30.0.2
    
 Build Information: 
 Mono: 5e9cb6d
 Java.Interop: xamarin/java.interop/d16-9@54f8c24
 ProGuard: Guardsquare/proguard/v7.0.1@912d149
 SQLite: xamarin/sqlite/3.34.1@daff8f4
 Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-9@d210f11
    
 === Microsoft OpenJDK for Mobile ===
    
 Java SDK: /Users/aguella/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
 1.8.0-25
 Android Designer EPL code available here:
 https://github.com/xamarin/AndroidDesigner.EPL
    
 === Android SDK Manager ===
    
 Version: 16.9.0.22
 Hash: a391de2
 Branch: remotes/origin/d16-9~2
 Build date: 2021-03-24 08:30:26 UTC
    
 === Android Device Manager ===
    
 Version: 16.9.0.17
 Hash: fc2b3db
 Branch: remotes/origin/dev/jmt/d16-9bump~1
 Build date: 2021-03-24 08:30:44 UTC
    
 === Apple Developer Tools ===
    
 Xcode 12.4 (17801)
 Build 12D4e
    
 === Xamarin.Mac ===
    
 Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.
    
 === Xamarin.iOS ===
    
 Version: 14.14.2.5 (Visual Studio Community)
 Hash: 3836759d4
 Branch: d16-9
 Build date: 2021-02-10 17:56:44-0500
    
 === Xamarin Designer ===
    
 Version: 16.9.0.324
 Hash: b1e216c75
 Branch: remotes/origin/d16-9
 Build date: 2021-04-16 00:02:50 UTC
    
 === Build Information ===
    
 Release ID: 809070008
 Git revision: 8b7ac2442978ec88d09703fafa4e43eb774f0a26
 Build date: 2021-04-16 07:38:03-04
 Build branch: release-8.9
 Xamarin extensions: 8b7ac2442978ec88d09703fafa4e43eb774f0a26
    
 === Operating System ===
    
 Mac OS X 10.16.0
 Darwin 20.3.0 Darwin Kernel Version 20.3.0
     Thu Jan 21 00:07:06 PST 2021
     root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64
dotnet-xamarin
· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@aguella-2168

May I know what's the OS version of your iPhone?

The problem is happening because developer disk image is not available , you can check the comment spouliot provided.

Workaound : Try to deploy on an iPhone with lower os version (e.g 14.1).


0 Votes 0 ·

I am on iOS 14.4. My Xamarin.iOS version is 14.16.0.5 and Xcode is version 12.5 which should support up to iOS 14.5

0 Votes 0 ·

Please update Xcode(12.5) and VS for mac(8.9.9) to the latest to see if problem persists.

0 Votes 0 ·
Show more comments

0 Answers