xcsync sync -tfm net9.0-ios issues after adding Widget Extension to generated project

Open
#181 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp, swift

Research direction

Reproduce the failure by syncing a generated .NET 9 iOS project after adding a Widget Extension. Start with XcodeObjectConverter.cs at line 18 and XcodeProjectObjectsJsonConverter.cs at line 30, then follow XcodeWorkspace.LoadProjectAsync at line 261. Done means xcsync can load and sync the generated project without the unknown PBXCopyFilesBuildPhase exception.

Written by the indexing model from the issue text.

Description

Hello,

Generating and syncing an Xcode project for our .NET9 MAUI application is functioning without any issues for a basic application. However, as soon as I add the Widget Extension to that project, I encounter the following error:

[13:37:35 INF xcsync (1)] Syncing files from project 'obj/Debug/net9.0-ios/iossimulator-x64/xcsync' to target 'MyApp.UI.csproj'
Unhandled exception: System.Text.Json.JsonException: Unknown isa value: PBXCopyFilesBuildPhase
   at xcsync.Projects.Xcode.XcodeObjectConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) in /_/src/xcsync/Projects/Xcode/XcodeObjectConverter.cs:line 18
   at xcsync.Projects.Xcode.XcodeProjectObjectsJsonConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) in /_/src/xcsync/Projects/Xcode/XcodeProjectObjectsJsonConverter.cs:line 30
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.ContinueDeserialize(ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.DeserializeAsync(Stream utf8Json, CancellationToken cancellationToken)
   at xcsync.Projects.XcodeWorkspace.LoadProjectAsync(String path, CancellationToken cancellationToken) in /_/src/xcsync/Projects/XcodeWorkspace.cs:line 261
   at xcsync.Projects.XcodeWorkspace.LoadAsync(CancellationToken cancellationToken) in /_/src/xcsync/Projects/XcodeWorkspace.cs:line 63
   at xcsync.SyncContext.SyncFromXcodeAsync(CancellationToken token) in /_/src/xcsync/SyncContext.cs:line 484
   at xcsync.SyncContext.SyncAsync(CancellationToken token) in /_/src/xcsync/SyncContext.cs:line 33
   at xcsync.Commands.SyncCommand.Execute() in /_/src/xcsync/Commands/SyncCommand.cs:line 22
   at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()

Is this a known bug, or is it related to the fact that the Widget Extension is based on SwiftUI rather than Objective-C? Currently, I have a working .NET MAUI application with Live Activity support by creating a (separate) native Xcode project with the same BundleIdentifiers as the MAUI iOS app.

Dominant language
C#
Stars
25
Forks
10
Avg merge
12h 50m
Merged PRs (30d)
10

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/xcsync

All issues in dotnet/xcsync

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.