You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@jamescrosswell@bricefriha one way to test if things are working, is getting a Release built Android app built on .NET 9, and see if we still get all C# line numbers in exceptions and crashes
@jamescrosswell@bricefriha one way to test if things are working, is getting a Release built Android app built on .NET 9, and see if we still get all C# line numbers in exceptions and crashes
Argh... this obviously slipped through the cracks.
.NET 9 does introduced a new AssemblyStore format for APK files. Reading the new format is demonstrated in assembly-store-reader-mk2 (which is a newer version of the store reader to the one we vendored in).
Unfortunately the code for assembly-store-reader-mk2 isn't yet complete and the functionality to read v1 store formats hasn't yet been implemented. As such, we're going to have to:
Vendor in the code to read v2 stores from assembly-store-reader-mk2
Find some way to determine whether the store is a v1 or v2 store and instantiate the appropriate reader (we already have an AndroidAssemblyReaderFactory that creates either a directory reader or a store reader)... hopefully we can extend this so it returns v1 or v2 as appropriate
Additionally, the current code we've got gets the apk path as so:
I'm not sure if that actually works in .NET 8 (needs to be tested). In .NET 9 at least, this returns /somepath/base.apk and, whilst that apk does exist in net9.0, it doesn't contain any of the .NET assemblies that we need to load. Instead, these appear to be in /somepath/split_config.[arch].apk (e.g. /somepath/split_config.arm64_v8a.apk on an arm64 v8a device).
It is possible to get a list of all the source dirs via Application.Context.ApplicationInfo?.SplitSourceDirs so we'll have to identify the appropriate path in that array based on the current architecture and then open that file in our new v2 store reader.
I tested this on a Release build of the Sentry.Samples.Maui application, using assembly-store-reader-mk2 tool from the dotnet/android repo and it works. So now all we have to do is vendor in that code as a new reader and find a way to instanciate the appropriate reader.
Activity
bruno-garcia commentedon Nov 17, 2024
@jamescrosswell @bricefriha one way to test if things are working, is getting a Release built Android app built on .NET 9, and see if we still get all C# line numbers in exceptions and crashes
jamescrosswell commentedon Mar 5, 2025
Argh... this obviously slipped through the cracks.
.NET 9 does introduced a new AssemblyStore format for APK files. Reading the new format is demonstrated in assembly-store-reader-mk2 (which is a newer version of the store reader to the one we vendored in).
The relvant commits appear to be:
/libdirectories dotnet/android#9154Unfortunately the code for
assembly-store-reader-mk2isn't yet complete and the functionality to read v1 store formats hasn't yet been implemented. As such, we're going to have to:assembly-store-reader-mk2Additionally, the current code we've got gets the apk path as so:
sentry-dotnet/src/Sentry/Platforms/Android/AndroidHelpers.cs
Line 27 in 1928a48
I'm not sure if that actually works in .NET 8 (needs to be tested). In .NET 9 at least, this returns
/somepath/base.apkand, whilst that apk does exist in net9.0, it doesn't contain any of the .NET assemblies that we need to load. Instead, these appear to be in/somepath/split_config.[arch].apk(e.g./somepath/split_config.arm64_v8a.apkon an arm64 v8a device).It is possible to get a list of all the source dirs via
Application.Context.ApplicationInfo?.SplitSourceDirsso we'll have to identify the appropriate path in that array based on the current architecture and then open that file in our new v2 store reader.I tested this on a Release build of the Sentry.Samples.Maui application, using assembly-store-reader-mk2 tool from the dotnet/android repo and it works. So now all we have to do is vendor in that code as a new reader and find a way to instanciate the appropriate reader.