-
-
Notifications
You must be signed in to change notification settings - Fork 220
Enable symbolication and source context for net9.0-android #4033
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
Conversation
With all the vendored-in code this is pretty hard to review. Can you link a diff showing your changes to the vendored code? |
Failing testNote that we originally had a test fail trying to decompress
When trying to decompress Basically I think the source bytes aren't a valid LZ4 archive 😕 I checked with the So although I was never able to get the tests to pass trying to read If we ever need to read facade assemblies in the future, this would need more digging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just skimmed this change. Ideally someone can do a proper review
$tfm = 'net8.0-' | ||
if (!$Tfm) | ||
{ | ||
$Tfm = 'net8.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
once we clear all callsites to pass a tfm, we should delete this and throw an error instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a default argument, if you don't specify a target framework. We could try to change the default to latest
or something like that - would need a little bit of extra scripting to work out what latest was.
{ | ||
#if ANDROID | ||
Skip.If(true, "It's unknown whether the current Android app APK is an assembly store or not."); | ||
#endif | ||
using var sut = GetSut(isAssemblyStore, isCompressed: true); | ||
if (isAssemblyStore) | ||
using var sut = GetSut(false, true, isCompressed: true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using var sut = GetSut(false, true, isCompressed: true); | |
using var sut = GetSut(isAot: false, isAssemblyStore: true, isCompressed: true); |
#if ANDROID | ||
Skip.If(true, "It's unknown whether the current Android app APK is an assembly store or not."); | ||
#endif | ||
using var sut = GetSut(false, false, isCompressed: true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using var sut = GetSut(false, false, isCompressed: true); | |
using var sut = GetSut(isAot: false, isAssemblyStore: false, isCompressed: true); |
@@ -54,27 +88,32 @@ public void CreatesCorrectReader(bool isAssemblyStore) | |||
[InlineData(true)] | |||
public void ReturnsNullIfAssemblyDoesntExist(bool isAssemblyStore) | |||
{ | |||
using var sut = GetSut(isAssemblyStore, isCompressed: true); | |||
using var sut = GetSut(false, isAssemblyStore, isCompressed: true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using var sut = GetSut(false, isAssemblyStore, isCompressed: true); | |
using var sut = GetSut(isAot: false, isAssemblyStore, isCompressed: true); |
Should fix `net-9.0` symbolication on android getsentry/sentry-dotnet#4033
Closes #3761:
Fixes #3983:
Fixes #3985:
Summary
.NET 9 does introduced a new AssemblyStore format for APK files. Reading the new format is demonstrated in assembly-store-reader-mk2. This PR adds support for reading the new format to the
AndroidAssemblyReaderFactory
.Also, the reason we didn't pick this up when we moved to
net9.0
is that the device tests are/were only running againstnet8.0
targets. In this PR we'll try to run the device tests onnet8.0-android/ios
andnet9.0-android/ios
.Notes for Reviewers
There's a lot of code here. However most of it is simply copied/vendored in from two external repositories.
ELFSharp
For the purposes of review, you can ignore all of the files in the "src/Sentry.Android.AssemblyReader/ELFSharp" folder.
The V2 format for APKs stores all assemblies in in an RID specific folder but Android requires all files in that folder to be ELF files... so during the build process any exe, dll, pdb or config files stored in there get "packed" into ELF files... we need to use ElfSharp to unpack these.
To avoid adding any dependencies, the code for ELFSharp has been copied in to the Sentry.Android.AssemblyReader project (with appropriate attribution).
dotnet/android
For the purposes of review, you can ignore most of the files in the "src/Sentry.Android.AssemblyReader/V2" folder.
src/Sentry.Android.AssemblyReader/V2/AndroidAssemblyStoreReaderV2.cs
andAndroidAssemblyDirectoryReaderV2
are classes I wrote (althoughAndroidAssemblyDirectoryReaderV2.ArchiveAssemblyHelper
was vendored in). Otherwise, all of the files insrc/Sentry.Android.AssemblyReader/V2
have been copied from thedotnet/android
repo, with appropriate attribution at the top of each file.No functional changes were made to any of that code. The only alterations were:
public
tointernal
Xamarin.LibZipSharp
(using the built in ZipFile class instead)Ctrl + .
in resharper to get the code to conform to our coding conventionsReferences
Relates to: