Skip to content

Commit

Permalink
Update Sentry.NET SDK to 3.27.0 and support symbolication on Android (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjohnsonpint committed Feb 1, 2023
1 parent a36c46d commit c61f61e
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 15 deletions.
24 changes: 16 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# Changelog

## 1.5.0

### Features

- Update Sentry.NET SDK to 3.27.0, which supports line numbers for Android ([#135](https://github.com/getsentry/sentry-xamarin/pull/135))
- [changelog](https://github.com/getsentry/sentry-dotnet/blob/3.27.0/CHANGELOG.md)
- [diff](https://github.com/getsentry/sentry-dotnet/compare/3.26.2...3.27.0)

## 1.4.6

### Fixes

- Update Sentry.NET SDK to 3.26.2 ([#133](https://github.com/getsentry/sentry-xamarin/pull/133))
- [changelog](https://github.com/getsentry/sentry-dotnet/blob/3.26.2/CHANGELOG.md)
- [diff](https://github.com/getsentry/sentry-dotnet/compare/3.23.1...3.26.2)
- [changelog](https://github.com/getsentry/sentry-dotnet/blob/3.26.2/CHANGELOG.md)
- [diff](https://github.com/getsentry/sentry-dotnet/compare/3.23.1...3.26.2)

## 1.4.5

Expand All @@ -19,24 +27,24 @@
### Fixes

- Update Sentry.NET SDK to 3.23.1 ([#128](https://github.com/getsentry/sentry-xamarin/pull/128))
- [changelog](https://github.com/getsentry/sentry-dotnet/blob/3.23.1/CHANGELOG.md)
- [diff](https://github.com/getsentry/sentry-dotnet/compare/3.22.0...3.23.1)
- [changelog](https://github.com/getsentry/sentry-dotnet/blob/3.23.1/CHANGELOG.md)
- [diff](https://github.com/getsentry/sentry-dotnet/compare/3.22.0...3.23.1)

## 1.4.3

### Fixes

- Update Sentry.NET SDK to 3.22.0 ([#127](https://github.com/getsentry/sentry-xamarin/pull/127))
- [changelog](https://github.com/getsentry/sentry-dotnet/blob/3.22.0/CHANGELOG.md)
- [diff](https://github.com/getsentry/sentry-dotnet/compare/3.20.1...3.22.0)
- [changelog](https://github.com/getsentry/sentry-dotnet/blob/3.22.0/CHANGELOG.md)
- [diff](https://github.com/getsentry/sentry-dotnet/compare/3.20.1...3.22.0)

## 1.4.2

### Fixes

- Update Sentry.NET SDK to 3.20.1 ([#125](https://github.com/getsentry/sentry-xamarin/pull/125))
- [changelog](https://github.com/getsentry/sentry-dotnet/blob/3.20.1/CHANGELOG.md)
- [diff](https://github.com/getsentry/sentry-dotnet/compare/3.17.1...3.20.1)
- [changelog](https://github.com/getsentry/sentry-dotnet/blob/3.20.1/CHANGELOG.md)
- [diff](https://github.com/getsentry/sentry-dotnet/compare/3.17.1...3.20.1)

## 1.4.1

Expand Down
1 change: 0 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Sentry" Version="3.26.2" />
<PackageReference Include="Roslynator.Analyzers" Version="3.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.1" PrivateAssets="All" />
Expand Down
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@ The package requires the following versions or newer:
* Xamarin.Essentials 1.4.0
* Sentry 3.0.0


## Limitations

There are no line numbers on stack traces for UWP and in release builds for Android and iOS, furthermore, mono symbolication is not yet supported.

## Resources

* [![Documentation](https://img.shields.io/badge/documentation-sentry.io-green.svg)](https://docs.sentry.io/platforms/dotnet/)
Expand Down
1 change: 0 additions & 1 deletion Src/Sentry.Xamarin.Forms/Sentry.Xamarin.Forms.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<ItemGroup>
<ProjectReference Include="..\Sentry.Xamarin\Sentry.Xamarin.csproj" />
<PackageReference Include="Xamarin.Forms" Version="4.6.0.726" />
<PackageReference Remove="Sentry" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('uap'))">
Expand Down
57 changes: 57 additions & 0 deletions Src/Sentry.Xamarin/Internals/SentryAndroidHelpers.droid.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.IO;
using Sentry.Android.AssemblyReader;
using Sentry.Extensibility;

using Appliction = Android.App.Application;
using AndroidBuild = Android.OS.Build;

namespace Sentry.Xamarin.Internals
{
internal static class SentryAndroidHelpers
{
public static IList<string> GetSupportedAbis()
{
var result = AndroidBuild.SupportedAbis;
if (result != null)
{
return result;
}

#pragma warning disable CS0618
var abi = AndroidBuild.CpuAbi;
#pragma warning restore CS0618

return abi != null ? new[] {abi} : Array.Empty<string>();
}

public static IAndroidAssemblyReader? GetAndroidAssemblyReader(IDiagnosticLogger? logger)
{
var apkPath = Appliction.Context.ApplicationInfo?.SourceDir;
if (apkPath == null)
{
logger?.LogWarning("Can't determine APK path.");
return null;
}

if (!File.Exists(apkPath))
{
logger?.LogWarning("APK doesn't exist at {0}", apkPath);
return null;
}

try
{
var supportedAbis = GetSupportedAbis();
return AndroidAssemblyReaderFactory.Open(apkPath, supportedAbis,
logger: (message, args) => logger?.Log(SentryLevel.Debug, message, args: args));
}
catch (Exception ex)
{
logger?.LogError("Cannot create assembly reader.", ex);
return null;
}
}
}
}
2 changes: 2 additions & 0 deletions Src/Sentry.Xamarin/Sentry.Xamarin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Sentry" Version="3.27.0" />
<PackageReference Include="Sentry.Android.AssemblyReader" Version="1.0.0" />
<PackageReference Include="Xamarin.Essentials" Version="1.6.1" />
</ItemGroup>

Expand Down
11 changes: 11 additions & 0 deletions Src/Sentry.Xamarin/SentryXamarinOptions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
using Sentry.Internals.Session;
using Sentry.Xamarin.Internals;

#if __ANDROID__
using System;
using Sentry.Android.AssemblyReader;
#endif

namespace Sentry
{
/// <summary>
Expand Down Expand Up @@ -46,6 +51,12 @@ public SentryXamarinOptions()
IsEnvironmentUser = false;
AutoSessionTracking = true;
IsGlobalModeEnabled = true;

#if __ANDROID__
var reader = new Lazy<IAndroidAssemblyReader?>(() =>
SentryAndroidHelpers.GetAndroidAssemblyReader(DiagnosticLogger));
AssemblyReader = name => reader.Value?.TryReadAssembly(name);
#endif
}
}
}

0 comments on commit c61f61e

Please sign in to comment.