Skip to content

Sentry.Maui doesn't work when deploying for iOS using "Hot Restart" #1961

Closed
@legrignotin

Description

Package

Sentry.Maui

.NET Version

6.0.304

OS

iOS

SDK Version

3.21.0-preview.3

Steps to Reproduce

  • Create a MAUI Application
  • Add Sentry NuGet
  • Add Following code:
         builder.UseSentry(options =>
         {
             // The DSN is the only required setting.
             options.Dsn = "MY DSN";


             // Use debug mode if you want to see what the SDK is doing.
             // Debug messages are written to stdout with Console.Writeline,
             // and are viewable in your IDE's debug console or with 'adb logcat', etc.
             // This option is not recommended when deploying your application.
#if DEBUG
             options.Debug = true;
#endif

             // Set TracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
             // We recommend adjusting this value in production.
             options.TracesSampleRate = 1.0;
             options.AttachStacktrace = true;
#if ANDROID
             options.Android.AttachScreenshot = true;
#endif
             options.CacheDirectoryPath = FileSystem.Current.AppDataDirectory;
         });
  • Build & Launch with Hot Restart on a Iphone (Iphone SE 2020)

Expected Result

The application launch without any error or crash

Actual Result

The application crash.

[0:] An error occurred: 'Could not create an native instance of the type 'SentryCocoa.SentryOptions': the native class hasn't been loaded.
It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.'. Callstack: ' at Foundation.NSObject.InitializeObject(Boolean alloced)
at Foundation.NSObject..ctor(NSObjectFlag x)
at SentryCocoa.SentryOptions..ctor() in //src/Sentry/obj/Release/net6.0-ios/iOS/SentryCocoa/SentryOptions.g.cs:line 59
at Sentry.SentrySdk.InitSentryCocoaSdk(SentryOptions options) in /
/src/Sentry/Platforms/iOS/SentrySdk.cs:line 22
at Sentry.SentrySdk.InitHub(SentryOptions options) in //src/Sentry/SentrySdk.cs:line 60
at Sentry.SentrySdk.Init(SentryOptions options) in /
/src/Sentry/SentrySdk.cs:line 109
at Sentry.Maui.Internal.SentryMauiInitializer.Initialize(IServiceProvider services) in /_/src/Sentry.Maui/Internal/SentryMauiInitializer.cs:line 12
at Microsoft.Maui.Hosting.MauiAppBuilder.Build()
at Mobile.MauiProgram.CreateMauiApp() in C:\Users\m\source\repos\Mobile\MauiProgram.cs:line 35
at Mobile.AppDelegate.CreateMauiApp() in C:\Users\m\source\repos\Mobile\Platforms\iOS\AppDelegate.cs:line 8
at Microsoft.Maui.MauiUIApplicationDelegate.WillFinishLaunching(UIApplication application, NSDictionary launchOptions)
at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass)
at Mobile.Program.Main(String[] args) in C:\Users\m\source\repos\Mobile\Platforms\iOS\Program.cs:line 13
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions