Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.12: SentryMauiOptions.Native not available on IOS anymore (was ok on 4.11) #3648

Closed
softlion opened this issue Oct 3, 2024 · 12 comments · Fixed by #3669
Closed

4.12: SentryMauiOptions.Native not available on IOS anymore (was ok on 4.11) #3648

softlion opened this issue Oct 3, 2024 · 12 comments · Fixed by #3669
Labels

Comments

@softlion
Copy link

softlion commented Oct 3, 2024

Package

Sentry

.NET Flavor

.NET

.NET Version

8.0.0

OS

iOS

SDK Version

4.12

Self-Hosted Sentry Version

No response

Steps to Reproduce

Image

Expected Result

No error building this code.
This code does compile ok on 4.11

Image

Actual Result

The Native property is not available anymore.

@jamescrosswell
Copy link
Collaborator

@softlion the Native options are used in the sample apps, e.g. here:

options.Native.EnableAppHangTracking = true;

So the solution wouldn't compile and we couldn't make a release if these weren't available.

Possibly clean your solution and restore workloads/packages?

@espenrl
Copy link

espenrl commented Oct 4, 2024

I'm experiencing the same thing. Had to downgrade. Even fails in CI where the caches start out from scratch.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Oct 4, 2024
@yguillermin
Copy link

@softlion the Native options are used in the sample apps, e.g. here:

sentry-dotnet/samples/Sentry.Samples.Ios/AppDelegate.cs

Line 25 in 43e28ad

         options.Native.EnableAppHangTracking = true; 

So the solution wouldn't compile and we couldn't make a release if these weren't available.

Possibly clean your solution and restore workloads/packages?

I have the same issue too. It work's on the sample project because sentry is referenced using a project reference. If you replace it using the NuGet package, the compilation will failed.

@bruno-garcia
Copy link
Member

Diff: 4.11.0...4.12.0

We didn't update sentry-cocoa nor the bindings project.

The only thing related to iOS that changed, was the xcode version.

Went from xcode 15.4 to 16

Image

I wonder if the .NET tooling has some issues with this version of xcode.

@jamescrosswell
Copy link
Collaborator

I'm unable to reproduce this. Here's my MauiProgram.cs which I tested first referencing Sentry.Maui 4.11.0 and then with 4.12.0:

public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var builder = MauiApp.CreateBuilder();
        builder
            .UseMauiApp<App>()
            // This adds Sentry to your Maui application
            .UseSentry(options =>
            {
                // The DSN is the only required option.
                options.Dsn = "MY_SENTRY_DSN";
                options.Debug = true;
#if __IOS__                
                options.Native.EnableSwizzling = true;
#endif
            })   
            .ConfigureFonts(fonts =>
            {
                fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
                fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
            });

#if DEBUG
        builder.Logging.AddDebug();
#endif

        return builder.Build();
    }
}

If anyone can provide a minimal reproduction then I can look into this though.

@espenrl
Copy link

espenrl commented Oct 7, 2024

If I do decompiled sources (ReSharper / Visual Studio) I get this for Android:

Image

But doing the same for iOS there is no Native property at all. But changing to v4.11 I get

Image

PS: Just deleted all Sentry packages from NuGet cache forcing a fresh download.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Oct 7, 2024
@espenrl
Copy link

espenrl commented Oct 7, 2024

And using DotPeek v2024.2.5 I have a hard time finding the existence of the property Native as well as its type NativeOptions. In this case for both Android and iOS assemblies. And both v4.11 and v4.12. Something is not right.

For v4.11 it at least works in Github CI and Visual Studio / ReSharper.

@espenrl
Copy link

espenrl commented Oct 7, 2024

Here might be something

Image

Seems like https://www.nuget.org/packages/Sentry.Bindings.Cocoa/4.12.0 isn't being referenced. Can't find traces of it in project.assets.json either on v4.12. On v4.11 I find this

Image

@espenrl
Copy link

espenrl commented Oct 7, 2024

I see there are issues with MAUI and XCode 16. Might be related to this issue as Sentry v4.12 started using XCode 16.

dotnet/maui#24819

Image

@espenrl
Copy link

espenrl commented Oct 7, 2024

And there are different targets between 4.11 and 4.12 in https://www.nuget.org/packages/Sentry. net8.0-ios17.5 vs net8.0-ios18.0. My project which fails building is targeting net8.0-ios and MAUI build system resolves it to net8.0-ios17.5 (project.assets.json).

I guess not everyone is building with the latest MAUI workload, which is true in my case. CI is locked to an older MAUI workload for iOS due to bugs introduces in the latest one.

Image

@softlion
Copy link
Author

softlion commented Oct 7, 2024

And there are different targets between 4.11 and 4.12 in https://www.nuget.org/packages/Sentry. net8.0-ios17.5 vs net8.0-ios18.0. My project which fails building is targeting net8.0-ios and MAUI build system resolves it to net8.0-ios17.5 (project.assets.json).

I guess not everyone is building with the latest MAUI workload, which is true in my case. CI is locked to an older MAUI workload for iOS due to bugs introduces in the latest one.

Image

You found the issue !!

To use this mew sentry nuget we all should use the latest net SDK which is 18 and requires xcode 16.

Sentry devs could instead specify both net8.0-ios and net8.0-ios17.5 in the targets.
That will fix the issue

@jamescrosswell
Copy link
Collaborator

To use this mew sentry nuget we all should use the latest net SDK which is 18 and requires xcode 16.

Aha, that makes sense. That was the main reason for making the 4.12 release (to support XCode 16).

Sentry devs could instead specify both net8.0-ios and net8.0-ios17.5 in the targets.

I'm not sure if that's practical. The reason we bumped to net8.0-ios18.0 is because net8.0-ios17.5 doesn't work with XCode 16... so in order to support both, we'd need two separate versions of the Sentry/Sentry.Maui packages: one set built using XCode 15.4 and the other built using XCode 16... and NuGet wouldn't know which one to pull because XCode isn't one of the dependencies it manages.

We'll discuss internally but for the time being I'll put a big warning about the change in dependencies in the change log, so hopefully fewer people get caught out by this.

Apologies in advance for any trouble this has caused folks. We'll definitely look into what happened here and try to avoid it happening again in future. Changes to tooling from multiple vendors who don't coordinate doesn't help things, but that's the world we live in so we need some good checks and balances in place to mitigate the impact of that on Sentry SDK users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants