sentry-dotnet icon indicating copy to clipboard operation
sentry-dotnet copied to clipboard

Maui iOS build error(s): The xcframework sentry.bindings.cocoa\5.10.0\lib\net8.0-ios17.0\Sentry.Bindings.Cocoa.resources.zip has an incorrect or unknown format and cannot be processed.

Open WeaverSystems opened this issue 5 months ago • 23 comments

Package

Sentry

.NET Flavor

.NET

.NET Version

9.0

OS

iOS

OS Version

No response

Development Environment

Visual Studio v17.x

SDK Version

5.10

Self-Hosted Sentry Version

No response

Workload Versions

UseSentry or SentrySdk.Init call

                .UseSentry(options =>
                {
                    //The DSN is the only required setting
                    options.Dsn = **************;

#if DEBUG             
                    options.Debug = true;
                    options.TracesSampleRate = 1.0;
#else
                    options.TracesSampleRate = 0.2;
#endif

                    //All other Sentry options
                    options.IsGlobalModeEnabled = true;
                    options.IncludeTextInBreadcrumbs = true;
                    options.IncludeTitleInBreadcrumbs = true;
                    options.IncludeBackgroundingStateInBreadcrumbs = true;
                    options.AttachStacktrace = true;
                    options.CaptureFailedRequests = true;
                });

Steps to Reproduce

  1. Update Visual Studio to 17.14.6 (June 2025).
  2. Try and build a Maui app with iOS and/or MacCatalyst platforms included.

Expected Result

Everything should build with no errors.

Actual Result

When trying to build our Maui project we're getting the following 4 errors:

  • The xcframework C:\Users******.nuget\packages\sentry.bindings.cocoa\5.10.0\lib\net8.0-ios17.0\Sentry.Bindings.Cocoa.resources.zip has an incorrect or unknown format and cannot be processed.
  • Can't process the zip file 'C:\Users******..nuget\packages\sentry.bindings.cocoa\5.10.0\lib\net8.0-maccatalyst17.0\Sentry.Bindings.Cocoa.resources.zip' on this platform: the file 'Sentry-Dynamic.xcframework/ios-arm64_arm64e_x86_64-maccatalyst/Sentry.framework/PrivateHeaders' is a symlink.
  • Can't process the zip file 'C:\Users******..nuget\packages\sentry.bindings.cocoa\5.10.0\lib\net8.0-maccatalyst17.0\Sentry.Bindings.Cocoa.resources.zip' on this platform: the file 'Sentry-Dynamic.xcframework/ios-arm64_arm64e_x86_64-maccatalyst/Sentry.framework/Resources' is a symlink.
  • The xcframework C:\Users******..nuget\packages\sentry.bindings.cocoa\5.10.0\lib\net8.0-maccatalyst17.0\Sentry.Bindings.Cocoa.resources.zip has an incorrect or unknown format and cannot be processed.

Updating Visual Studio to 17.14.6 (June 2025) is the cause - I guarantee it. Everything built correctly yesterday, but clearly Microsoft have changed something in their Maui compilation that's caused this mismatch with Sentry.

(by the way I am aware of https://docs.sentry.io/platforms/dotnet/guides/maui/troubleshooting/#visual-studio-hot-restart-incompatibility, but I don't have Hot Restart enabled, so that's not a problem, this is definitely caused by the VS update).

WeaverSystems avatar Jun 18 '25 13:06 WeaverSystems

Thanks, @WeaverSystems, for the bug report. And thanks for sifting through troubleshooting.

To further help us triaging:

  1. From which Visual Studio version have you been upgrading from?
    • v17.13.* or less
    • v17.14.0 or greater
  2. Does this error only occur when building from Visual Studio
    • or does it also occur when trying to build from the .NET SDK (dotnet build)

My initial thoughts:

  • Could this issue be related to an outdated/incompatible dotnet workload?
  • May currently unreleased changes alleviate the issue?
    • #4260
    • #4272

I'll try to reproduce the issue when I'm back on a Windows machine.

Flash0ver avatar Jun 18 '25 15:06 Flash0ver

I was upgrading from the previous VS release, so 17.14.5.

I've just tried a CLI build, unfortunately with the same result.

WeaverSystems avatar Jun 19 '25 08:06 WeaverSystems

I’m experiencing the same issue. The error only happens when building in Visual Studio 2022. The build works fine in Azure Pipelines. I managed to get it working on the Android emulator by disabling everything related to Hot Reload in VS2022. However, the same problem still occurs when running on the iOS simulator. I’m building from VS2022 on Windows and running the iOS simulator on a Mac. This issue started after I updated VS2022 from version 17.14.5 to 17.14.6.

kenroencordel avatar Jun 19 '25 12:06 kenroencordel

Tried a CLI build, unfortunately with the same result. And This was after updating Visual Studio to 17.14.6

Orgbrat avatar Jun 19 '25 15:06 Orgbrat

Just ran into the same problem, I upgraded VS to 17.14.6 Preview 1.0 and xcode to 16.4 and the problem just started.

IntegraSysIncJP avatar Jun 19 '25 20:06 IntegraSysIncJP

Thanks for your feedback - this helps a lot.

There may be an issue connected to the bundled .NET SDK 9.0.301 from Visual Studio 17.14.6 on Windows.

I'll be able to test this scenario on my Windows-macOS-Setup over the weekend. And we'll also automate the Windows/Visual-Studio experience to catch related issues in the future earlier: #4299

Flash0ver avatar Jun 20 '25 09:06 Flash0ver

Could we get info from the Microsoft team about what changed (is there a change log) to help us navigate this?

Did other packages that contain native bindings also break?

bruno-garcia avatar Jun 20 '25 12:06 bruno-garcia

Another question: the title says net8.0.

Are the apps targeting net8? Does it work with dotnet 9? I wonder if it's a breaking change with net8 bundling/packaging of native bindings.

bruno-garcia avatar Jun 20 '25 12:06 bruno-garcia

I don't think it's net8.0 only, as we also got a report for net9.0: see #4293

Flash0ver avatar Jun 20 '25 12:06 Flash0ver

@Flash0ver I backed VS Preview back to 17.14.5 Preview 1.0 at ios level 18.4.0.0 and the problem went away. "Sentry.Maui" Version="5.11.0" compiles fine now.

As far as other binding libs, I have two that uses the xcframework and they both compile ok, haven't tested them with the latest upgrade but no compile errors.

Note: I am using .Net 9

IntegraSysIncJP avatar Jun 20 '25 13:06 IntegraSysIncJP

Raised:

  • https://github.com/dotnet/macios/issues/23101

bruno-garcia avatar Jun 20 '25 13:06 bruno-garcia

Thanks @IntegraSysIncJP for the additional reproductions and diagnostics.

@bruno-garcia asked on Discord and this issue seems to originate from dotnet (see mentioned issue above).

We need a minimal sample project and/or a binlog. I'll reproduce the problem when I'm back on my Windows machine to get a binlog. ~But feel free to beat me to it 😉:~

  • dotnet build -bl
  • msbuild Solution-Or-Project /bl

I'm uncertain whether the current version of MSBuild includes potentially sensitive data per default. Anyway, the BinLog-Viewer can help with redaction: see https://msbuildlog.com/ However, be careful not to accidentally leak any sensitive data.

Flash0ver avatar Jun 20 '25 13:06 Flash0ver

@bruno-garcia I can confirm that whilst the error messages say .net 8 it is affecting .net 9, as that's what we're using.

WeaverSystems avatar Jun 20 '25 14:06 WeaverSystems

Repo with Repro & .binlog: https://github.com/Flash0ver/dotnet-macios-issues-23101

Thanks everybody for helping with the diagnostics!

In the meantime, as a workaround, you may Rollback to the previous version of Visual Studio: See https://devblogs.microsoft.com/visualstudio/introducing-visual-studio-rollback/

Flash0ver avatar Jun 20 '25 21:06 Flash0ver

Thank you Stefan!

bruno-garcia avatar Jun 20 '25 21:06 bruno-garcia

@WeaverSystems, @rad765, @Orgbrat, @kenroencordel, @IntegraSysIncJP. It appears that the issue only occurs when building for Mac Catalyst, but works fine for iOS. As a workaround - until the issue is fixed - you may remove/disable the Mac Catalyst target on Windows for now. See https://github.com/dotnet/macios/issues/23101#issuecomment-2998929627.

Flash0ver avatar Jun 23 '25 23:06 Flash0ver

I updated to sentry 5.11.2 but I still have the same error on

.nuget\packages\sentry.bindings.cocoa\5.11.2\lib\net8.0-ios17.0\Sentry.Bindings.Cocoa.resources.zip xcframework is incorrect or unknown and cannot be processed.

What I have to do?

AngeloLazzari avatar Jun 25 '25 07:06 AngeloLazzari

I had the same error as @AngeloLazzari using 5.11.2. I tried the fix mentioned by @Flash0ver but it did not work for me.

I don't use MacCatalst so I removed it as a build target in all my .csproj files..

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

<PropertyGroup>
	<TargetFrameworks>net9.0-android;net9.0-ios</TargetFrameworks>
	<!--Removing "net9.0-maccatalyst" above is a workaround for Sentry causing a build error: https://github.com/dotnet/macios/issues/23101#issuecomment-2998929627-->
	<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>`

My project now builds. I tested it on Windows and Android.

Surfrat avatar Jun 25 '25 09:06 Surfrat

@AngeloLazzari, until https://github.com/dotnet/macios/issues/23101 is fixed, you may

  • roll back to Visual Studio 17.14.5 or less
  • disable Mac Catalyst targets, like @Surfrat did (thanks for sharing your workaround)

Flash0ver avatar Jun 25 '25 11:06 Flash0ver

ok thanks! Angelo

AngeloLazzari avatar Jun 25 '25 13:06 AngeloLazzari

@Flash0ver how long it will take the fix to arrive? We are not able to downgrade VS because we need to test the app with the last xcode version and we have a big app to send to stores....

@Surfrat thanks for the fix, but if I put that code in the csproj the proyect is not working anymore...

Thank you!

AngeloLazzari avatar Jun 25 '25 14:06 AngeloLazzari

@AngeloLazzari I'm afraid I can't tell. Please refer to https://github.com/dotnet/macios/issues/23101 for the issue's status. And would you mind sharing your MSBuild properties that don't work ... perhaps we can help with the workaround.

Flash0ver avatar Jun 25 '25 14:06 Flash0ver

@AngeloLazzari You must not add my code to your csproj. Just remove net9.0-maccatalyst from the <TargetFrameworks> section.

Surfrat avatar Jun 26 '25 07:06 Surfrat

Is this being fixed? Apologies if I've missed an update saying so. I'm still on VS 17.4.5 and would like to upgrade soon. Thanks!

ldl01031 avatar Jul 08 '25 19:07 ldl01031

@FlashOver - How will today's .NET 9.0.7 affect this situation? I'm Only building for IOS, Android and Windows (no net9.0-maccatalyst).

This has been on-going for 3 weeks? I've been writing code since 1972. Any 100% repeatable bug is a gift from Heaven and Simple to fix??

Is Sentry a viable company with an actual programming staff? For a company with 'Code Breaks, Fix it Faster' as their web banner, this situation has been Very disappointing?

I placed my faith in Sentry mostly due to a @jamesmontemagno recommendation. I just see so little activity here that I'm wondering if I need to explore other options as I now have an important IOS release with Zero logging.

Is this going to be fixed? When? What is the reason for these many weeks without a fix?

exquirentibus avatar Jul 08 '25 20:07 exquirentibus

@ldl01031 @exquirentibus I think you're both aware of this tracking issue right?

  • https://github.com/dotnet/macios/issues/23101

It looks like the issue is in the dotnet repo then (not Sentry)... the best we can do here is offer workarounds (like disabling macatalyst targets).

Or have I misunderstood something?

jamescrosswell avatar Jul 08 '25 21:07 jamescrosswell

@ldl01031 @exquirentibus I think you're both aware of this tracking issue right?

It looks like the issue is in the dotnet repo then (not Sentry)... the best we can do here is offer workarounds (like disabling macatalyst targets).

Or have I misunderstood something?

I was not aware of the tracking issue; it's the info I was looking for [and I understand other's frustrations!] Thank you.

ldl01031 avatar Jul 08 '25 22:07 ldl01031

@ldl01031 @exquirentibus I think you're both aware of this tracking issue right?

* [Maui iOS build error(s): The xcframework sentry.bindings.cocoa\5.10.0\lib\net8.0-ios17.0\Sentry.Bindings.Cocoa.resources.zip has an incorrect or unknown format and cannot be processed. dotnet/macios#23101](https://github.com/dotnet/macios/issues/23101)

It looks like the issue is in the dotnet repo then (not Sentry)... the best we can do here is offer workarounds (like disabling macatalyst targets).

Or have I misunderstood something?

If it's the .NET repo, are there concise steps to go Back to another that will succeed? I tried to do that previously with my AI but was not successful in building?

I'm Only having issues with Sentry. If I remove it (I put steps on that other link last week), I can build And publish IOS.

As .NET builds are in motion for quite some time before they are released, I'd hope that Sentry would be testing and providing feedback (if it Is the build's fault) so that a New build does Not go out that Breaks important features (like Logging)?

exquirentibus avatar Jul 08 '25 22:07 exquirentibus

@exquirentibus per the issue description:

Revert the Visual Studio version to 17.14.5

Or alternatively, from further down in the conversation, only target maccatalyst when not building on Windows:

<TargetFrameworks>net9.0-android;net9.0-ios</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>

jamescrosswell avatar Jul 08 '25 22:07 jamescrosswell

@exquirentibus per the issue description:

Revert the Visual Studio version to 17.14.5

Or alternatively, from further down in the conversation, only target maccatalyst when not building on Windows:

<TargetFrameworks>net9.0-android;net9.0-ios</TargetFrameworks> <TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-maccatalyst</TargetFrameworks> <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>

MS doesn't really give you the ability to install a particular version of VS? So I don't believe you Can 'revert' to 17.14.5?

I'd tried an older 17.12.1 I kept around. And tried going back to an earlier .NET9.

I'm normally running 17.14.7 (of course there's an Update to that today).

I'm NEVER targeting maccatalyst? Only IOS, Android & Windows?

exquirentibus avatar Jul 09 '25 01:07 exquirentibus