getsentry / sentry-xamarin Goto Github PK
View Code? Open in Web Editor NEWSentry for Xamarin Native and Xamarin.Forms
Home Page: https://docs.sentry.io/platforms/dotnet/guides/xamarin/
Sentry for Xamarin Native and Xamarin.Forms
Home Page: https://docs.sentry.io/platforms/dotnet/guides/xamarin/
on my app I was registering the following tags:
@bruno-garcia should I add something like that to Sentry Xamarin?
To not lose the comment from Matt
Yikes. I see this was in the old code and you are just refactoring, but we really shouldn't completely lose this task. It should be saved somewhere. We should also register it for cancellation so it can be shut down gracefully. I'm OK if this is done in a future PR, but wanted to point it out.
On
For native android/ios and flutter app start instrumentation is already implemented. This is also a very important KPI for Xamarin and would be highly appreciated.
The app must include the following features.
We're using up-for-grabs
label, and raising well documented issues so community members can participate.
Let's list the repo on https://github.com/up-for-grabs/up-for-grabs.net to get more visibility.
Basically copy and paste the following files for this repo.
https://github.com/getsentry/sentry-dotnet/blob/main/dangerfile.js
https://github.com/getsentry/sentry-dotnet/blob/main/.github/workflows/danger.yml
it generates a lot of noise on PRs since it's an automatically generated file on Xamarin projects.
I created this issue to discuss some possibilities to enhance the Screenshot feature.
Add a user option to choose the minimum event level to attach a screenshot, where the use case is a user not wanting screenshots with debug/info/warning events but error and fatal.
Add a user option to choose the picture quality (could be a low/medium/high enum or a percentage from 1 to 100), the reasoning is, current device resolutions are getting too high and with that, screenshots are getting bigger.
sample_pictures.zip <- sample pictures to compare the compression quality.
By default, 50% seems to be a good balance between size and quality.
If you have any other ideas, feel free to comment.
Right now there's a project for testing the SDK with UWP, but it's not integrated with Github Actions.
It would be great to integrate it so future Pull Requests will be checked against UWP.
Based on https://docs.sentry.io/platforms/react-native/configuration/releases/#bind-the-version and getsentry/sentry-dotnet#668 .
Since Sentry .NET doesn't register the release version for Xamarin apps, the integration is going to register the app version by the following pattern:
${my-project-name}@{package_version}
Preferably, tests that are able to run using Github Actions.
App shell does also have routing and it would be an important KPI to measure the time it takes navigating between pages.
How do you use Sentry?
Sentry SaaS (sentry.io) or self-hosted/on-premise (which version?)
Which SDK and version?
sentry xamarin SDK 1.3.1
1- integrate sentry SDK into android xamarin app, and activate the screenshot feature.
2- generate a random error in debug mode
3- generate a random error in release mode
you can see screenshot in debug mode, and you can't see screenshot in release mode
you can see screenshot in debug mode, and you can't see screenshot in release mode
Any ideas why this is happening? If i tried sentry on a completely new app, it's not an issue, but when i used it in my app , this is what happened when trying to send a message
Which SDK and version?
Sentry.Xamarin 1.0.3
Refit 5.2.4 (i don't know if this is related but this package have a reference to System.Text.Json as well)
Just Init in my app and attempt to send a message
Should not throw this excpetion
Error: Failed to send cached envelope: System.MissingMethodException: Method not found: System.Text.Json.JsonDocument System.Text.Json.JsonDocument.Parse(System.ReadOnlyMemory`1,System.Text.Json.JsonDocumentOptions)
at Sentry.Protocol.Envelopes.Envelope.DeserializeHeaderAsync (System.IO.Stream stream, System.Threading.CancellationToken cancellationToken) [0x001a1] in //src/Sentry/Envelopes/Envelope.cs:152
at Sentry.Protocol.Envelopes.Envelope.DeserializeAsync (System.IO.Stream stream, System.Threading.CancellationToken cancellationToken) [0x00032] in //src/Sentry/Envelopes/Envelope.cs:164
at Sentry.Internal.Http.CachingTransport.ProcessCacheAsync (System.Threading.CancellationToken cancellationToken) [0x00117] in /_/src/Sentry/Internal/Http/CachingTransport.cs:173 , discarding cached envelope.
When we bundle the Sentry iOS SDK we need to take into account that Mono uses some signals to interpret NullReferenceException
s and need special case (run before other crash reports do):
See: https://www.mono-project.com/docs/advanced/signals/#incomplete-solution
See also: dotnet/runtime#44736
This is probably something we can do in the binding project, before calling Init
in the iOS SDK.
Proposed solution, based on the Mono docs:
try {
} finally {
Mono.Runtime.RemoveSignalHandlers ();
try {
// Init the Sentry iOS SDK:
SentrySDK.start(...);
} finally {
Mono.Runtime.InstallSignalHandlers ();
}
}
Since Mono’s signal handlers are reinstalled and not restored, Mono will now chain to the signal handlers installed by EnableCrashReporting.
The code is executed in a finally block, so that the Mono runtime will never abort it under any circumstance.
It’s recommended to do this as early as possible when launching the process, in particular before starting any secondary threads. If any signals are raised between removing and reinstalling Mono’s signal handlers (this includes NullReferenceExceptions), the app will crash.
See: https://www.mono-project.com/docs/advanced/signals/#complete-solution
During the Microsoft Xamarin Community Standup they presented this repository. It felt like the README could do a better job explaining what this SDK does and what Sentry is.
The idea is to show on a simple image What's Sentry and what it does once you use it with your code.
The SDK supports automatic navigation breadcrumbs and also device context information.
With that, I present you with this mockup
Sadly, I lack the skills for making this fancy so it would be nice if anyone could help to give this Paint image some Sentry image quality touch :D
mono doesn't offer the line numbers in release mode, it'll require an update to Symbolicator to retrieve the correct line numbers. But for now, no line numbers (the same for any error monitoring tool that supports Xamarin).
Fix the name to Sentry.Xamarin.Forms.UWP.Tests
How do you use Sentry?
Sentry SaaS (sentry.io)
Which SDK and version?
Sentry.Xamarin 1.4.0
No crash should come from Sentry.Xamarin assemblies.
We're seeing this crash being reported in Sentry in our Xamarin.Droid app:
System.AggregateException
A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. (No such host is known)
System.Net.Sockets.SocketException: No such host is known
?, in async ValueTask<ValueTuple<Socket, Stream>> ConnectHelper.ConnectAsync(string host, int port, CancellationToken cancellationToken)
System.Net.Http.HttpRequestException: No such host is known
?, in async ValueTask<ValueTuple<Socket, Stream>> ConnectHelper.ConnectAsync(string host, int port, CancellationToken cancellationToken)
?, in async ValueTask<ValueTuple<HttpConnection, HttpResponseMessage>> HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
?, in async ValueTask<ValueTuple<HttpConnection, HttpResponseMessage>> HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask<ValueTuple<HttpConnection, HttpResponseMessage>> creationTask)
?, in async Task<HttpResponseMessage> HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, bool doRequestAuth, CancellationToken cancellationToken)
?, in async Task<HttpResponseMessage> RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
?, in async Task<HttpResponseMessage> DecompressionHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
?, in async Task<HttpResponseMessage> GzipBufferedRequestBodyHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
?, in async Task<HttpResponseMessage> RetryAfterHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
?, in async Task<HttpResponseMessage> HttpClient.FinishSendAsyncBuffered(Task<HttpResponseMessage> sendTask, HttpRequestMessage request, CancellationTokenSource cts, bool disposeCts)
?, in async Task HttpTransport.SendEnvelopeAsync(Envelope envelope, CancellationToken cancellationToken)
?, in async Task CachingTransport.InnerProcessCacheAsync(string file, CancellationToken cancellation) x 2
?, in async Task CachingTransport.ProcessCacheAsync(CancellationToken cancellation)
?, in async Task CachingTransport.FlushAsync(CancellationToken cancellationToken)
Additionally we get this assembly information: Assembly:Sentry Version:3.16.0.0 Culture:neutral PublicKeyToken:fba2ec45388e2af0
This feature exists on native and flutter and would also be a great kpi to have for Xamarin (forms).
Add C# 8 Nullable Reference Types. Since the framework versions in this project don't support it, we need to use a shim such as used in the .NET SDK for the TFMs below .NET Core 3.0 (where no nullability annotation exists).
XAML Exceptions don't crash the app but are often ignored.
Inform the user how to log XAML Exceptions with a sample app, but also with documentation.
public partial class SomePage : ContentPage
{
public Disco()
{
try
{
InitializeComponent();
}
catch(Exception ex)
{
SentrySdk.CaptureException(ex);
}
}
}
Context at: xamarin/xamarin-macios#10732 (comment)
If we chose not to do this or if it doesn't work, we need to simply document this argument is needed
How do you use Sentry?
Sentry SaaS (sentry.io)
SDK
Sentry.Xamarin 1.1.0
Device
iPhone 8, iOS 14.4.2
SentryXamarin.Init(o =>
{
o.Dsn = AppSettings.Instance.SentryDsn;
o.SendDefaultPii = false;
o.AttachStacktrace = true;
o.Debug = true;
};
Application crashes and an exception report is sent to Sentry.io console.
Application crashes but no exception report is sent to Sentry.io console.
2021-06-23 10:14:20.495 Application.iOS[18946:3360565] Info: Capturing event.
2021-06-23 10:14:20.506 Application.iOS[18946:3360565] Debug: Running processor on exception: Sentry test ios
2021-06-23 10:14:20.511 Application.iOS[18946:3360565] Debug: Creating SentryStackTrace. isCurrentStackTrace: False.
Loaded assembly: /private/var/containers/Bundle/Application/7564202E-DA49-4955-AA15-13553B0D241E/Application.iOS.app/System.Threading.Tasks.Extensions.dll
2021-06-23 10:14:20.538 Application.iOS[18946:3360565] Debug: Running main event processor on: Event 2b66ec3e32584a4cb768e6fc88b670a6
2021-06-23 10:14:20.551 Application.iOS[18946:3360565] Debug: Envelope queued up.
2021-06-23 10:14:20.551 Application.iOS[18946:3360565] Info: Disposing the Hub.
2021-06-23 10:14:20.552 Application.iOS[18946:3360565] Debug: Disposing SentryClient.
2021-06-23 10:14:20.552 Application.iOS[18946:3360565] Debug: Disposing BackgroundWorker.
2021-06-23 10:14:20.554 Application.iOS[18946:3360622] Debug: Storing file /var/mobile/Containers/Data/Application/C12643CF-4CE8-45C4-A3B0-BBACFDF281EC/Documents/Sentry/28CE05E461034F7F5AAEDE4C9F962FF60F06F79A/1624436060_-2717_2b66ec3e32584a4cb768e6fc88b670a6_-588163899.envelope.
2021-06-23 10:14:20.589 Application.iOS[18946:3360622] Debug: Envelope 2b66ec3e32584a4cb768e6fc88b670a6 handed off to transport. #1 in queue.
2021-06-23 10:14:20.602 Application.iOS[18946:3360635] Debug: Flushing cached envelopes.
2021-06-23 10:14:20.602 Application.iOS[18946:3360630] Debug: Shutdown scheduled. Stopping by: 00:00:02. #0 in queue.
2021-06-23 10:14:20.602 Application.iOS[18946:3360630] Info: Exiting the worker with an empty queue.
2021-06-23 10:14:20.604 Application.iOS[18946:3360635] Debug: Reading cached envelope: /var/mobile/Containers/Data/Application/C12643CF-4CE8-45C4-A3B0-BBACFDF281EC/Documents/Sentry/28CE05E461034F7F5AAEDE4C9F962FF60F06F79A/__processing/1624436060_-2717_2b66ec3e32584a4cb768e6fc88b670a6_-588163899.envelope
2021-06-23 10:14:20.607 Application.iOS[18946:3360635] Error: Failed to send cached envelope: System.Threading.Tasks.TaskCanceledException: A task was canceled.
at Sentry.Internal.Extensions.StreamExtensions+<ReadAllBytesAsync>d__0.MoveNext () [0x000b7] in /_/src/Sentry/Internal/Extensions/StreamExtensions.cs:18
at Sentry.Internal.Extensions.StreamExtensions+<ReadAllBytesAsync>d__0.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult (System.Int16 token) <0x108b132e0 + 0x0005f> in <21de525d6d944e1892c9b758d850e8d6#f76cceb590763b94e6fe78680461b832>:0
at System.Threading.Tasks.ValueTask`1[TResult].get_Result () [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:818
at Sentry.Protocol.Envelopes.Envelope.DeserializeHeaderAsync (System.IO.Stream stream, System.Threading.CancellationToken cancellationToken) [0x000a0] in /_/src/Sentry/Envelopes/Envelope.cs:140
at Sentry.Protocol.Envelopes.Envelope.DeserializeHeaderAsync (System.IO.Stream stream, System.Threading.CancellationToken cancellationToken) [0x0016b] in /_/src/Sentry/Envelopes/Envelope.cs:140
at Sentry.Protocol.Envelopes.Envelope.DeserializeAsync (System.IO.Stream stream, System.Threading.CancellationToken cancellationToken) [0x00032] in /_/src/Sentry/Envelopes/Envelope.cs:164
at Sentry.Internal.Http.CachingTransport.ProcessCacheAsync (System.Threading.CancellationToken cancellationToken) [0x0012c] in /_/src/Sentry/Internal/Http/CachingTransport.cs:176
at Sentry.Internal.Http.CachingTransport.ProcessCacheAsync (System.Threading.CancellationToken cancellationToken) [0x002e8] in /_/src/Sentry/Internal/Http/CachingTransport.cs:186 , retrying after a delay.
2021-06-23 10:14:20.607 Application.iOS[18946:3360635] Debug: Background worker of CachingTransport has shutdown.
2021-06-23 10:14:20.607 Application.iOS[18946:3360565] Debug: Disposing scope.
2021-06-23 10:14:20.607 Application.iOS[18946:3360565] Debug: Disposing SentryScopeManager.
Disable offline caching for iOS.
Currently the options object doesn't have any XML docs:
sentry-xamarin/Src/Sentry.Xamarin/SentryXamarinOptions.cs
Lines 10 to 17 in fb0bdce
Any ideas why this is happening? I used it in my app , this is what happened when trying to send a message.
Which SDK and version?
Sentry.Xamarin 1.3.1
Sentry 3.9.2
System.Memory 4.5.4
System.Buffers 4.5.1
Just Init in my app and attempt to capture a null
exception
Should not throw this exception
Debug: Reading cached envelope: <path-to-cache-envelope>
Error: Failed to send cached envelope: <path-to-cache-envelope>, discarding cached envelope.
System.ExecutionEngineException: Attempting to JIT compile method 'System.Text.Json.JsonElement Sentry.Internal.Json:Parse (byte[])' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.
at Sentry.Protocol.Envelopes.Envelope.DeserializeHeaderAsync (System.IO.Stream stream, System.Threading.CancellationToken cancellationToken) [0x001a1] in /_/src/Sentry/Envelopes/Envelope.cs:186
at Sentry.Protocol.Envelopes.Envelope.DeserializeAsync (System.IO.Stream stream, System.Threading.CancellationToken cancellationToken) [0x00032] in /_/src/Sentry/Envelopes/Envelope.cs:198
at Sentry.Internal.Http.CachingTransport.ProcessCacheAsync (System.Threading.CancellationToken cancellationToken) [0x00111] in /_/src/Sentry/Internal/Http/CachingTransport.cs:163
at Sentry.Internal.Http.CachingTransport.ProcessCacheAsync (System.Threading.CancellationToken cancellationToken) [0x002cd] in /_/src/Sentry/Internal/Http/CachingTransport.cs:172 Debug: Reading cached envelope: <path-to-cache-envelope>
How do you use Sentry?
sentry.io
Which SDK and version?
Sentry.Xamarin.Forms 1.3.1
Exception should be sent to sentry when application restarted
Exception not sent to Sentry. I attach the stacktrace so it can help. My device Xiaomi Redmi 5A (API 27)
stacktrace.txt
This issue serves to track the GA release of this library.
How do you use Sentry?
sentry.io
Which SDK and version?
Sentry.Xamarin.Forms 1.3.1
The nuget package should be installed.
This works for Xamarin.Droid and Xamarin.iOS but when I try to do it in Portable it doesn't work. It gives me the error
Severity Code Description Project File Line Suppression State
Error NU1202 Package Sentry.Xamarin.Forms 1.3.1 is not compatible with portable45-net45+win8+wp8+wpa81 (.NETPortable,Version=v4.5,Profile=Profile259) / win10-arm-aot. Package Sentry.Xamarin.Forms 1.3.1 supports: netstandard2.0 (.NETStandard,Version=v2.0) RecrutoStaff C:\Recruto Projects\recruto-staff\RecrutoStaff\RecrutoStaff.csproj 1
What am I doing wrong?
The app must include the following features.
Add performance to the Xamarin Forms showcasing the following use-cases:
Recently a user on Discord asked why a crash (throw null
) right after SentryXamarin.Init
wasn't captured on a Xamarin app.
The explanation is:
When you load the app for the first time, it inits Sentry and immediately crashes. Sentry, writes that crash data to a file (can't send it to Sentry before the app crashes). So when the app restarts, you Init Sentry again, and Sentry sees the file and tries to send. But since that's now blocking the app from launching, it only waits up to 1 second. If ti can't send it to Sentry before that, it lets the app continue to launch. But right after initing Sentry, it crashes again.
So it worked for me, but it might not work for you depending on the latency you have between the device and Sentry for example.
One way around this, is to configure how long you're OK with the SDK blocking the app lunch if it finds a crash file:
SentryXamarin.Init(options =>
{
options.Dsn = "...";
options.InitCacheFlushTimeout = TimeSpan.FromSeconds(10);
});
it will wait "up to 10 seconds" for a crash to be sent when the app restarts. The default is 1 second only I believe
You can also turn it off and if the app is just crashing right while opening up, it will just never capture that
Turns out this is actually documented here: https://docs.sentry.io/platforms/dotnet/configuration/options/#init-cache-flush-timeout
It could be beneficial for Xamarin particularly to get more information about this, since offline caching is on
by default.
I'm using a custom NavigationPage in my app. This means that Sentry logs my navigation page as a breadcrumb. I see that it is coded to ignore NavigationPage. It would be nice if I could specify other page types to ignore in the breadcrumb logging.
Going one step farther, it would be nice to specify a logging handler for the custom page types for further customization.
The troubleshooting approach for android shown here
https://docs.sentry.io/platforms/dotnet/guides/xamarin/troubleshooting/#android
works both on android and ios. Why not just put it like that in the documentation and avoid customer frustration?
Our app seems to be crashing every now and then on multiple devices. This is the error reported by Sentry:
System.ArgumentNullException: Value cannot be null.
Parameter name: first
?, in IEnumerable<KeyValuePair<string, string>> Enumerable.Except<KeyValuePair<string, string>>(IEnumerable<KeyValuePair<string, string>> first, IEnumerable<KeyValuePair<string, string>> second)
?, in void IHubExtensions.AddInternalBreadcrumb(IHub hub, SentryXamarinOptions options, string message, string category, string type, Dictionary<string, string> data, BreadcrumbLevel level)
?, in void NativeIntegration.<get_MemoryWarning>b__12_0(?)+(NSNotification _) => { }
?, in void InternalNSNotificationHandler.Post(NSNotification s)
?, in void UIApplication.Main(string[] args, IntPtr principal, IntPtr delegate) x 2
?, in void Application.Main(string[] args)
It seems it is this code that is causing the error: (IHubExtensions.cs line: 36)
!previousBreadcrumb.Data.Except(data).Any() &&
I guess putting in a null-conditional behind .Data would solve the issue, but it might go deeper than that?
.Data?.Except
The app must include the following features.
The idea is to include screenshots with events. Like this:
Currently, Xamarin Grabs the Objective-C Exception message, stack trace, type and stores it into the C# Exception message.
By doing that, you'll not be able to Symbolicate the Exception and Grouping has the potential to mix Exceptions.
The Ideal Scenario is to Parse the Objective-C Exceptions with a new StackTraceProcessor for iOS by joining the C# StackTrace with the Native StackTrace.
For this to be possible, getsentry/sentry-dotnet#744 needs to be merged in order to filter the Instruction Addresses from the Native Exception.
##Notes
Regex Rule for filtering the StackTrace:
=> "(?<id>\\d+)\\s+(?<method>[a-zA-Z\\.-_?]+)\\s+(?<offset>0x[0-9a-fA-F]+)\\s+(?<function>.+?(?=\\s\\+))\\s+\\+\\s+(?<line>\\d+)";
net6.0-ios13.0
Invoke SentryXamarin.Init
in AppDelegate
constructor.
The app started without crash and Sentry is initialized successfully.
The app crashed after start:
Unhandled managed exception: Operation is not supported on this platform.
(System.PlatformNotSupportedException)
at System.Net.Http.NSUrlSessionHandler.get_SupportsAutomaticDecompression()
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
--- End of stack trace from previous location ---
at System.Net.Http.HttpClientHandler.InvokeNativeHandlerMethod(String name, Object[] parameters)
at System.Net.Http.HttpClientHandler.GetSupportsAutomaticDecompression()
at System.Net.Http.HttpClientHandler.get_SupportsAutomaticDecompression()
at Sentry.Internal.Http.DefaultSentryHttpClientFactory.Create(SentryOptions options)
at Sentry.Internal.SdkComposer.CreateTransport()
at Sentry.Internal.SdkComposer.CreateBackgroundWorker()
at Sentry.SentryClient..ctor(SentryOptions options, IBackgroundWorker worker)
at Sentry.SentryClient..ctor(SentryOptions options)
at Sentry.Internal.Hub..ctor(SentryOpti<…>
Right now the SDK is targeting Android 10, but it would be nice if it was able to target at least Android 5.0.
Right now, in case your app doesn't target Android 10, the Native Integrations for Android are going to be disabled.
How do you use Sentry?
sentry.io
Which SDK and version?
Sentry.Xamarin.Forms 1.3.1
I expected the exception to be reported to Sentry.
The exception was not reported and when I checked the logs it said
Error: Failed to send cached envelope: /data/user/0/se.recruto.app/files/.local/share/Sentry/02A6EA804EEE9F2AB1F3BD97BAB66F72272DC6B4/__processing/1641814777_9932__-1903654489.envelope, discarding cached envelope.
System.MissingMethodException: Method not found: System.Text.Json.JsonDocument System.Text.Json.JsonDocument.Parse(System.ReadOnlyMemory`1<byte>,System.Text.Json.JsonDocumentOptions)
at Sentry.Protocol.Envelopes.Envelope.DeserializeHeaderAsync (System.IO.Stream stream, System.Threading.CancellationToken cancellationToken) [0x001a1] in /_/src/Sentry/Envelopes/Envelope.cs:186
at Sentry.Protocol.Envelopes.Envelope.DeserializeAsync (System.IO.Stream stream, System.Threading.CancellationToken cancellationToken) [0x00032] in /_/src/Sentry/Envelopes/Envelope.cs:198
at Sentry.Internal.Http.CachingTransport.ProcessCacheAsync (System.Threading.CancellationToken cancellationToken) [0x00111] in /_/src/Sentry/Internal/Http/CachingTransport.cs:163
at Sentry.Internal.Http.CachingTransport.ProcessCacheAsync (System.Threading.CancellationToken cancellationToken) [0x002cd] in /_/src/Sentry/Internal/Http/CachingTransport.cs:172 Debug: No cached file to process.
Debug: Registering integration: 'AutoSessionTrackingIntegration'.
Debug: Attempting to recover persisted session from file.
Debug: A persisted session does not exist at /data/user/0/se.recruto.app/files/.local/share/Sentry/02A6EA804EEE9F2AB1F3BD97BAB66F72272DC6B4/.session.
Debug: Created directory for installation ID file (/data/user/0/se.recruto.app/files/.local/share/Sentry/02A6EA804EEE9F2AB1F3BD97BAB66F72272DC6B4).
Debug: Resolved installation ID '0c23f0cd-ccac-4536-bcbb-d2a136c08785'.
Info: Started new session (SID: c71750ea3c184978949e5ccccdef11cb; DID: 0c23f0cd-ccac-4536-bcbb-d2a136c08785).
If I add the options.DisableOfflineCaching(); in the init it works. This article https://docs.sentry.io/platforms/dotnet/guides/xamarin/troubleshooting/ explains how to fix it on iOS but not on Android.
Right now the SDK is only installed if you have Xamarin Forms, blocking non Forms users from using it.
The goal is to remove the dependency of Xamarin.Forms from Android, iOS, and ideally, UWP), we might keep it for platforms without Native Integrations implemented like Tizen.
Error: Error while processing envelope (event ID: '88e99c4ae34249ebbf05d99480580758'). #1 in queue.
info
09:20:39
Console.Write
System.MissingMethodException: Constructor on type 'System.Text.Json.Serialization.Converters.DictionaryOfTKeyTValueConverter`3[[System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String[], mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String[], mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' not found.
at System.RuntimeType.CreateInstanceImpl (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes, System.Threading.StackCrawlMark& stackMark) <0x100a67290 + 0x00640> in <25bf495f7d6b4944aa395b3ab5293479#66408fa1874fecacca7e1004891fd210>:0
at System.Activator.CreateInstance (System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) <0x100c422ec + 0x000bb> in <25bf495f7d6b4944aa395b3ab5293479#66408fa1874fecacca7e1004891fd210>:0
at System.Activator.CreateInstance (System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture) <0x100c422d8 + 0x0000b> in <25bf495f7d6b4944aa395b3ab5293479#66408fa1874fecacca7e1004891fd210>:0
at System.Text.Json.Serialization.Converters.IEnumerableConverterFactory.CreateConverter (System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) <0x102da7658 + 0x00203> in <cb68364b029e41c3bf425990b94c94d9#66408fa1874fecacca7e1004891fd210>:0
at System.Text.Json.JsonSerializerOptions.GetConverter (System.Type typeToConvert) <0x102d909b4 + 0x0034b> in <cb68364b029e41c3bf425990b94c94d9#66408fa1874fecacca7e1004891fd210>:0
at System.Text.Json.JsonSerializerOptions.DetermineConverter (System.Type parentClassType, System.Type runtimePropertyType, System.Reflection.MemberInfo memberInfo) <0x102d90840 + 0x000a7> in <cb68364b029e41c3bf425990b94c94d9#66408fa1874fecacca7e1004891fd210>:0
at System.Text.Json.JsonClassInfo.GetConverter (System.Type type, System.Type parentClassType, System.Reflection.MemberInfo memberInfo, System.Type& runtimeType, System.Text.Json.JsonSerializerOptions options) <0x102d8cc18 + 0x0005f> in <cb68364b029e41c3bf425990b94c94d9#66408fa1874fecacca7e1004891fd210>:0
at System.Text.Json.JsonClassInfo..ctor (System.Type type, System.Text.Json.JsonSerializerOptions options) <0x102d8b89c + 0x0008f> in <cb68364b029e41c3bf425990b94c94d9#66408fa1874fecacca7e1004891fd210>:0
at System.Text.Json.JsonSerializerOptions.GetOrAddClass (System.Type type) <0x102d915b8 + 0x0007b> in <cb68364b029e41c3bf425990b94c94d9#66408fa1874fecacca7e1004891fd210>:0
at System.Text.Json.WriteStack.Initialize (System.Type type, System.Text.Json.JsonSerializerOptions options, System.Boolean supportContinuation) <0x102d91d5c + 0x0003b> in <cb68364b029e41c3bf425990b94c94d9#66408fa1874fecacca7e1004891fd210>:0
at System.Text.Json.JsonSerializer.WriteCore[TValue] (System.Text.Json.Utf8JsonWriter writer, TValue& value, System.Type inputType, System.Text.Json.JsonSerializerOptions options) <0x102d8fb78 + 0x0008f> in <cb68364b029e41c3bf425990b94c94d9#66408fa1874fecacca7e1004891fd210>:0
at System.Text.Json.JsonSerializer.Serialize[TValue] (System.Text.Json.Utf8JsonWriter writer, TValue& value, System.Type type, System.Text.Json.JsonSerializerOptions options) <0x102d8fdd8 + 0x0005b> in <cb68364b029e41c3bf425990b94c94d9#66408fa1874fecacca7e1004891fd210>:0
at System.Text.Json.JsonSerializer.Serialize[TValue] (System.Text.Json.Utf8JsonWriter writer, TValue value, System.Text.Json.JsonSerializerOptions options) <0x102d8fd54 + 0x0005f> in <cb68364b029e41c3bf425990b94c94d9#66408fa1874fecacca7e1004891fd210>:0
at Sentry.Internal.Extensions.JsonExtensions.WriteDynamicValue (System.Text.Json.Utf8JsonWriter writer, System.Object value) <0x102c6c47c + 0x00323> in <c543491de6524fd4addbd87a9ec2d93a#66408fa1874fecacca7e1004891fd210>:0
at Sentry.Internal.Extensions.JsonExtensions.WriteDynamic (System.Text.Json.Utf8JsonWriter writer, System.String propertyName, System.Object value) <0x102c6c950 + 0x00027> in <c543491de6524fd4addbd87a9ec2d93a#66408fa1874fecacca7e1004891fd210>:0
at Sentry.Internal.Extensions.JsonExtensions.WriteDictionaryValue (System.Text.Json.Utf8JsonWriter writer, System.Collections.Generic.IEnumerable`1[T] dic) <0x102c6bbb4 + 0x000cf> in <c543491de6524fd4addbd87a9ec2d93a#66408fa1874fecacca7e1004891fd210>:0
at Sentry.Contexts.WriteTo (System.Text.Json.Utf8JsonWriter writer) <0x102c46058 + 0x00013> in <c543491de6524fd4addbd87a9ec2d93a#66408fa1874fecacca7e1004891fd210>:0
at Sentry.Internal.Extensions.JsonExtensions.WriteSerializableValue (System.Text.Json.Utf8JsonWriter writer, Sentry.IJsonSerializable value) <0x102c6c3cc + 0x00043> in <c543491de6524fd4addbd87a9ec2d93a#66408fa1874fecacca7e1004891fd210>:0
at Sentry.Internal.Extensions.JsonExtensions.WriteSerializable (System.Text.Json.Utf8JsonWriter writer, System.String propertyName, Sentry.IJsonSerializable value) <0x102c6c438 + 0x00027> in <c543491de6524fd4addbd87a9ec2d93a#66408fa1874fecacca7e1004891fd210>:0
at Sentry.Transaction.WriteTo (System.Text.Json.Utf8JsonWriter writer) <0x102c57d80 + 0x00153> in <c543491de6524fd4addbd87a9ec2d93a#66408fa1874fecacca7e1004891fd210>:0
at Sentry.Protocol.Envelopes.JsonSerializable.SerializeAsync (System.IO.Stream stream, System.Threading.CancellationToken cancellationToken) <0x102c1d790 + 0x00173> in <c543491de6524fd4addbd87a9ec2d93a#66408fa1874fecacca7e1004891fd210>:0
at Sentry.Protocol.Envelopes.JsonSerializable.SerializeAsync (System.IO.Stream stream, System.Threading.CancellationToken cancellationToken) <0x102c1d790 + 0x0088b> in <c543491de6524fd4addbd87a9ec2d93a#66408fa1874fecacca7e1004891fd210>:0
at Sentry.Protocol.Envelopes.EnvelopeItem.BufferPayloadAsync (System.Threading.CancellationToken cancellationToken) <0x102c787ac + 0x0017b> in <c543491de6524fd4addbd87a9ec2d93a#66408fa1874fecacca7e1004891fd210>:0
at Sentry.Protocol.Envelopes.EnvelopeItem.SerializeAsync (System.IO.Stream stream, System.Threading.CancellationToken cancellationToken) <0x102c1a6b0 + 0x0089b> in <c543491de6524fd4addbd87a9ec2d93a#66408fa1874fecacca7e1004891fd210>:0
at Sentry.Protocol.Envelopes.Envelope.SerializeAsync (System.IO.Stream stream, System.Threading.CancellationToken cancellationToken) <0x102c186b0 + 0x00727> in <c543491de6524fd4addbd87a9ec2d93a#66408fa1874fecacca7e1004891fd210>:0
at Sentry.Internal.Http.CachingTransport.StoreToCacheAsync (Sentry.Protocol.Envelopes.Envelope envelope, System.Threading.CancellationToken cancellationToken) <0x102c10930 + 0x00903> in <c543491de6524fd4addbd87a9ec2d93a#66408fa1874fecacca7e1004891fd210>:0
at Sentry.Internal.Http.CachingTransport.StoreToCacheAsync (Sentry.Protocol.Envelopes.Envelope envelope, System.Threading.CancellationToken cancellationToken) <0x102c10930 + 0x00e33> in <c543491de6524fd4addbd87a9ec2d93a#66408fa1874fecacca7e1004891fd210>:0
at Sentry.Internal.Http.CachingTransport.SendEnvelopeAsync (Sentry.Protocol.Envelopes.Envelope envelope, System.Threading.CancellationToken cancellationToken) <0x102c66a48 + 0x00123> in <c543491de6524fd4addbd87a9ec2d93a#66408fa1874fecacca7e1004891fd210>:0
at Sentry.Internal.BackgroundWorker.WorkerAsync () <0x102c0b0b0 + 0x00da7> in <c543491de6524fd4addbd87a9ec2d93a#66408fa1874fecacca7e1004891fd210>:0
It can be mitigated by adding the following linker rule:
<assembly fullname="System.Text.Json">
<type fullname="System.Text.Json.Serialization.Converters.*" preserve="all"/>
</assembly>
Ideally we should add this to the troubleshooting session
EDIT Repro:
SentrySdk.ConfigureScope(scope =>
{
scope.Contexts["New Context"] = new Dictionary<string, string[]>
{ { "Item", new[] { "1" , "2", "3 " } } };
});
SentrySdk.CaptureMessage("Hello World");
More information here: https://github.com/getsentry/sentry-xamarin/runs/5490199607?check_suite_focus=true
Which SDK and version?
Sentry 3.0.7
Sentry.Xamarin.Forms 1.0.2
Forcing via Thread.Sleep for easy reproducing:
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
SentryXamarin.Init(options =>
{
options.Dsn = SENTRY_DSN;
options.Release = Version.Major + "." + Version.Minor;
options.SendDefaultPii = true;
options.AddXamarinFormsIntegration();
});
System.Threading.Thread.Sleep(3000);
No Exception should be raised
Register() Method tries to call DiagnosticLogger, which is null, which causes the exception.
application is null, because start takes longer than 3000 ms in SentryXamarinFormsIntegration.cs:
private async Task<Application> GetCurrentApplication()
{
for (int i = 0; i < 10 && Application.Current is null; i++)
{
await Task.Delay(300).ConfigureAwait(false);
}
return Application.Current;
}
Run App on a faster computer ;-)
Add a Timeout / loop setting for application start. maybe reduce delay and increase loop times.
Add null check for call "options.DiagnosticLogger.Log()"
Add options to Init:
public class SentryLogger : IDiagnosticLogger
{
public bool IsEnabled(SentryLevel level)
{
return true;
}
public void Log(SentryLevel logLevel, string message, Exception exception = null, params object[] args)
{
Debug.WriteLine(message, args);
}
}
...
SentryXamarin.Init(options =>
{
options.DiagnosticLogger = new SentryLogger();
options.Debug = true;
...
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.