Cannot Build iOS on Real Device: Error resolving type specified in JSON

Auri A. Rahimzadeh 31 Reputation points
2025-06-09T22:53:20.7666667+00:00

Not getting this on other projects, but the project files look effectively the same and I'm not using any special nugets that shouldn't be cross platform... Any ideas? Copilot says this is a "known issue" and that I need to ensure XCode is up to date. It is. 

I can build and run on the iOS simulator and on a local device. Android works, too.

Visual Studio 17.14.4, Enterprise.

This is ONLY an issue if I try to target a real device connected to the mac or the generic Remote Device. Kind of a problem, since I can't archive without it.

Also looking to see if I can get Rider to build it, since there may be VS magic at play here. Eaten two days trying to figure this out. Thanks for any help you can provide!

Full error:

MessagingRemoteException: A problem occurred while deserializing an error message for topic build6982072852aurir/error/xvs/build/18.4.9288/execute-task/<app name removed>/48cf768002fPrepareResourceRules

JsonSerializationException: Error resolving type specified in JSON 'System.Collections.Generic.List`1[[Xamarin.Messaging.Exceptions.ExceptionSerializableProperty, Xamarin.MacDev.Tasks]], System.Private.CoreLib'. Path 'InnerExceptionInformation.SerializableProperties.$type'.

JsonSerializationException: Could not load assembly 'System.Private.CoreLib'.

Full stack trace:

3>Done building project "<removed>.Mobile.csproj".

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning : [xma][err]: An exception occurred in the task 'PrepareResourceRules'

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning : A problem occurred while deserializing an error message for topic build698206764aurir/error/xvs/build/18.4.9288/execute-task/<removed>.Mobile/48cf768002fPrepareResourceRules

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at Xamarin.Messaging.Client.ApplicationMessageExtensions.<>c__DisplayClass8_0`1.<OfResponse>b__1(MessagingMqttMessage m) in D:\a_work\1\s\src\Xamarin.Messaging.Client\Extensions\ApplicationMessageExtensions.cs:line 210

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Reactive.Linq.ObservableImpl.Select`2.Selector._.OnNext(TSource value)

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning : --- End of stack trace from previous location where exception was thrown ---

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at Xamarin.Messaging.Client.MessagingClient.<PostAsync>d__21`2.MoveNext() in D:\a_work\1\s\src\Xamarin.Messaging.Client\MessagingClient.cs:line 223

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning : --- End of stack trace from previous location where exception was thrown ---

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at Xamarin.Messaging.Ssh.MessagingRunnerPro.<ExecuteWithRetryAsync>d__13`1.MoveNext() in D:\a_work\1\s\src\Xamarin.Messaging.Ssh\MessagingRunnerPro.cs:line 55

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning : --- End of stack trace from previous location where exception was thrown ---

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at Xamarin.Messaging.Ssh.MessagingRunnerPro.ThrowIfConnected(ExceptionDispatchInfo exceptionInfo, IMessagingAnalyticsAction analytics) in D:\a_work\1\s\src\Xamarin.Messaging.Ssh\MessagingRunnerPro.cs:line 145

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at Xamarin.Messaging.Ssh.MessagingRunnerPro.<HandleExceptionAsync>d__15`1.MoveNext() in D:\a_work\1\s\src\Xamarin.Messaging.Ssh\MessagingRunnerPro.cs:line 96

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning : --- End of stack trace from previous location where exception was thrown ---

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at Xamarin.Messaging.Ssh.MessagingRunnerPro.<ExecuteWithRetryAsync>d__13`1.MoveNext() in D:\a_work\1\s\src\Xamarin.Messaging.Ssh\MessagingRunnerPro.cs:line 62

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning : --- End of stack trace from previous location where exception was thrown ---

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at Xamarin.Messaging.Ssh.MessagingRunnerPro.<ExecuteWithRetryAsync>d__11`1.MoveNext() in D:\a_work\1\s\src\Xamarin.Messaging.Ssh\MessagingRunnerPro.cs:line 39

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning : --- End of stack trace from previous location where exception was thrown ---

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at Xamarin.Messaging.Ssh.MessagingClientPro.<PostAsync>d__26`2.MoveNext() in D:\a_work\1\s\src\Xamarin.Messaging.Ssh\MessagingClientPro.cs:line 147

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning : --- End of stack trace from previous location where exception was thrown ---

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at Xamarin.Messaging.Build.Client.BuildClient.<RunMessagingAsync>d__34`2.MoveNext() in D:\a_work\1\s\src\MSBuild\Xamarin.Messaging.Build.Client\BuildClient.cs:line 388

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning : --- End of stack trace from previous location where exception was thrown ---

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at Xamarin.Messaging.Build.Client.BuildClient.<ExecuteTaskAsync>d__20.MoveNext() in D:\a_work\1\s\src\MSBuild\Xamarin.Messaging.Build.Client\BuildClient.cs:line 96

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning : --- End of stack trace from previous location where exception was thrown ---

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): warning :    at Xamarin.Messaging.Build.Client.TaskRunner.<RunAsync>d__6.MoveNext() in D:\a_work\1\s\src\MSBuild\Xamarin.Messaging.Build.Client\TaskRunner.cs:line 70

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): error : MessagingRemoteException: A problem occurred while deserializing an error message for topic build698206764aurir/error/xvs/build/18.4.9288/execute-task/<removed>.Mobile/48cf768002fPrepareResourceRules

3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(2570,3): error : JsonSerializationException: Error resolving type specified in JSON 'System.Collections.Generic.List`1[[Xamarin.Messaging.Exceptions.ExceptionSerializableProperty, Xamarin.MacDev.Tasks]], System.Private.CoreLib'. Path 'InnerExceptionInformation.SerializableProperties.$type'.

Developer technologies | .NET | .NET MAUI
0 comments No comments
{count} vote

3 answers

Sort by: Most helpful
  1. AdamKrist-4453 0 Reputation points
    2025-06-10T19:20:55.93+00:00

    NOT fix, but a painful work around if you need a .ipa ... copy your files to mac, use command line to build/publish. Eventually I got an .ipa into Testflight. Make sure your Distribution Cert is NOT created from VS2022 Apple Account dialog.

    dotnet publish -f:net9.0-ios -c Release -r ios-arm64 \

    -p:BuildIpa=true \

    -p:CodesignKey="Apple Distribution: Your Name (TEAMID)" \

    -p:CodesignProvision="YOUR_PROFILE_UUID"

    Spent a couple of days trying to figure this out (no luck). Trouble started when I Upgrade macOS to Sequoia, and Xcode 16.3. As a clue to someone interested in this, I was building/debugging on iPhone fine, until I tried to start publishing the build (Provisioning, Certs, ...), that's when I started getting this error. Not sure where I went wrong.


  2. Auri A. Rahimzadeh 31 Reputation points
    2025-06-10T22:22:43.2866667+00:00

    OK I found the answer... but I still think it's a bug because it's not an issue in the simulator. Reported the issue in Visual Studio feedback here: https://developercommunity.visualstudio.com/t/Cannot-Build-iOS-to-Real-Device-Works-F/10919954?

    And here's the fix:

    What a misleading error message! Compared to a project that works after seeing others online recommending “create a new project and then it works.”

    Visual Studio had inserted a CodesignResourceRules entry. Never seen this before.

    What a nightmare figuring this out. Can Microsoft improve this error message? If this isn’t a valid entry or scenario, I think they should check for it, possibly auto-remove it when Entitlements.plist gets special treatment when it shouldn't.

    <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net9.0-ios|AnyCPU'">
          <ApplicationTitle>app name</ApplicationTitle>
          <ApplicationId>com.app.name</ApplicationId>
          <CodesignResourceRules>Platforms\iOS\Entitlements.plist</CodesignResourceRules>
          <ApplicationVersion>4</ApplicationVersion>
        </PropertyGroup>
    

    Removing that solved the build issue:

    <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net9.0-ios|AnyCPU'">
          <ApplicationTitle>app name</ApplicationTitle>
          <ApplicationId>com.app.name</ApplicationId>
          <ApplicationVersion>4</ApplicationVersion>
        </PropertyGroup>
    

  3. Harry Vo (WICLOUD CORPORATION) 1,315 Reputation points Microsoft External Staff
    2025-08-28T04:20:38.9466667+00:00

    Hi @Auri A. Rahimzadeh , sorry to bother you! I'm posting this answer to help others who might encounter the same issue.

    This error happens when the project file contains a legacy <CodesignResourceRules> entry (often pointing to Entitlements.plist). This is because older Xamarin.iOS templates included this property to support pre-Xcode 8 signing, where codesign required a “resource rules” plist. New versions of Xcode no longer support --resource-rules, so when building for a real device the signing step fails.

    So, remove the <CodesignResourceRules> property from your .csproj will fix this issue. For example:

    <PropertyGroup>   
    	<ApplicationTitle>app name</ApplicationTitle>   
    	<ApplicationId>com.app.name</ApplicationId>   
    	<ApplicationVersion>4</ApplicationVersion
    </PropertyGroup>
    

    What a misleading error message! Compared to a project that works after seeing others online recommending “create a new project and then it works.”

    The reason why you think it's a misleading error message is because on Windows, Visual Studio builds iOS apps by relaying results from the Mac host via the Xamarin Messaging layer. When codesign fails, the underlying exception can’t be serialized across processes, so you see a generic JsonSerializationException instead of a clear “invalid codesign resource rules” error. That’s why it only shows up on device builds, not on the simulator (which skips signing).


    What a nightmare figuring this out. Can Microsoft improve this error message?

    The property can be added by older templates or by VS migration logic. Because some projects may still build against older toolchains, Visual Studio doesn’t automatically strip it out, even though Apple has deprecated resource rules entirely (Apple TN2206).


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.