Skip to content
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

feat: debug images for Portable PDB #2050

Merged
merged 51 commits into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
577cfb3
feat: Support Symbolication for Portable PDB.
Swatinem Oct 11, 2022
31a1631
refactor: renames & cleanup
vaind Nov 15, 2022
6ad2a87
chore: code readability
vaind Nov 15, 2022
ed49941
refactor: extract DebugStackTrace from StackTraceFactory
vaind Nov 15, 2022
2226fb7
fix: stack trace capture on asp.net
vaind Nov 16, 2022
e7f789a
fix: debug images on multi-exception events
vaind Nov 16, 2022
464cd2d
test: fix some tests
vaind Nov 16, 2022
4d6e5f7
test: update verifier settings
vaind Nov 17, 2022
e954b61
test: update api aproval snapshots
vaind Nov 17, 2022
ea91f58
test: script to update verifier expected files
vaind Nov 17, 2022
b9b3926
test: update verifier snapshots
vaind Nov 17, 2022
504c335
test: more fixes
vaind Nov 17, 2022
aaf9f4c
chore: remove unused MonoStackTraceFactory
vaind Nov 17, 2022
bde81e5
ujj8
vaind Nov 21, 2022
9b53d71
test: update verifier results for mono
vaind Nov 22, 2022
4a434a5
test: update verifier results
vaind Nov 22, 2022
fdd9a3d
test: fix verifier
vaind Nov 22, 2022
87f4982
test: update verifier
vaind Nov 22, 2022
e34cab9
feat: android assembly reader (wip)
vaind Nov 22, 2022
73845e9
test: update AndroidAssemblyReader tests
vaind Nov 23, 2022
73e8c02
feat: assembly decompression
vaind Nov 23, 2022
97661a0
fix: non-store assembly reader - cannot open APK for writing on device
vaind Nov 23, 2022
a69b110
feat: Android AssemblyStore support
vaind Nov 24, 2022
2a66f26
chore: update test dependencies
vaind Nov 24, 2022
f9005b0
chore: rebase fixup
vaind Nov 24, 2022
353d2fb
chore: rebase fixup
vaind Nov 25, 2022
3bbf1f7
test: fix AssemblyReader tests on Android
vaind Nov 25, 2022
96ef5b3
test: update verifier
vaind Nov 25, 2022
89db86f
refactor: DebugStackTrace and add more tests
vaind Nov 25, 2022
5963847
fix: AndroidAssemblyReader ReadIndex
vaind Nov 28, 2022
637c191
fix: DebugStackTrace Android AssemblyReader init locking
vaind Dec 6, 2022
0501aa6
chore: minor review changes
vaind Dec 6, 2022
002dfc1
Merge branch 'main' into feat/debug-image-info
mattjohnsonpint Dec 16, 2022
bba77b3
Misc cleanup
mattjohnsonpint Dec 16, 2022
089de06
Seal SentryStackTraceFactory
mattjohnsonpint Dec 16, 2022
bd2d634
More cleanup / refactoring
mattjohnsonpint Dec 16, 2022
86efc0a
Merge branch 'main' into feat/debug-image-info
mattjohnsonpint Dec 16, 2022
ebbcea1
Move assembly reader and tests to fix dependency
mattjohnsonpint Dec 18, 2022
6fb380f
.
mattjohnsonpint Dec 18, 2022
e41b7ec
.
mattjohnsonpint Dec 18, 2022
491bf7b
.
mattjohnsonpint Dec 19, 2022
625456f
Update CHANGELOG.md
mattjohnsonpint Dec 19, 2022
6b56e4c
.
mattjohnsonpint Dec 19, 2022
821429d
.
mattjohnsonpint Dec 19, 2022
337109c
Use lazy instead of manual lock
mattjohnsonpint Dec 19, 2022
8fa03e9
Use a dedicated test app for the android assembly reader tests
mattjohnsonpint Dec 19, 2022
934dc87
.
mattjohnsonpint Dec 19, 2022
82d99bf
.
mattjohnsonpint Dec 19, 2022
9ce6c7e
Merge branch 'main' into feat/debug-image-info
mattjohnsonpint Dec 19, 2022
6e42fde
.
mattjohnsonpint Dec 19, 2022
2c532be
.
mattjohnsonpint Dec 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ docs/docfx.zip
*.received.*
mono_crash.*.json
test_output/
test/**/*.apk
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Features

- Add support for Portable PDB format ([#2050](https://github.com/getsentry/sentry-dotnet/pull/2050))

## 3.24.1

### Fixes
Expand Down
18 changes: 15 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Contributing

We love receiving PRs from the community with features and fixed.
We love receiving PRs from the community with features and fixed.
For big feature it's advised to raise an issue to discuss it first.

## TLDR:
## TLDR

* Install the .NET SDKs
* To quickly get up and running, you can just run `dotnet build`
Expand Down Expand Up @@ -68,7 +68,7 @@ Note that the MSBuild version should always be `17.0` but will change paths base
We'd love for users to update the SDK everytime and as soon as we make a new release. But in reality most users rarely update the SDK.
To help users see value in updating the SDK, we maintain a changelog file with entries split between two headings:

1. `### Features`
1. `### Features`
2. `### Fixes`

We add the heading in the first PR that's adding either a feature or fixes in the current release.
Expand All @@ -86,3 +86,15 @@ Below that, you'll add the heading 3 mentioned above. For example, if you're add
```

There's a GitHub action check to verify if an entry was added. If the entry isn't a user-facing change, you can skip the verification with `#skip-changelog` written to the PR description. The bot writes a comment in the PR with a suggestion entry to the changelog based on the PR title.

## Verify tests

Some tests use [Verify](https://github.com/VerifyTests/Verify) to check returned objects against snapshots that are part of the repo.
In case you're making code changes that produce many (intended) changes in those snapshots, you can use [accept-verifier-changes.ps1](./scripts/accept-verifier-changes.ps1) like this:

```shell-script
dotnet test
pwsh ./scripts/accept-verifier-changes.ps1
```

You may need to run this multiple times because `dotnet test` stops after a certain number of failures.
1 change: 1 addition & 0 deletions Sentry-CI-Build-Linux.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"src\\Sentry.NLog\\Sentry.NLog.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
"src\\Sentry\\Sentry.csproj",
"test\\Sentry.Android.Tests\\Sentry.Android.Tests.csproj",
"test\\Sentry.AspNet.Tests\\Sentry.AspNet.Tests.csproj",
"test\\Sentry.AspNetCore.Grpc.Tests\\Sentry.AspNetCore.Grpc.Tests.csproj",
"test\\Sentry.AspNetCore.Tests\\Sentry.AspNetCore.Tests.csproj",
Expand Down
1 change: 1 addition & 0 deletions Sentry-CI-Build-Windows.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"src\\Sentry.NLog\\Sentry.NLog.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
"src\\Sentry\\Sentry.csproj",
"test\\Sentry.Android.Tests\\Sentry.Android.Tests.csproj",
"test\\Sentry.AspNet.Tests\\Sentry.AspNet.Tests.csproj",
"test\\Sentry.AspNetCore.Grpc.Tests\\Sentry.AspNetCore.Grpc.Tests.csproj",
"test\\Sentry.AspNetCore.Tests\\Sentry.AspNetCore.Tests.csproj",
Expand Down
1 change: 1 addition & 0 deletions Sentry-CI-Build-macOS.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"src\\Sentry.NLog\\Sentry.NLog.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
"src\\Sentry\\Sentry.csproj",
"test\\Sentry.Android.Tests\\Sentry.Android.Tests.csproj",
"test\\Sentry.AspNet.Tests\\Sentry.AspNet.Tests.csproj",
"test\\Sentry.AspNetCore.Grpc.Tests\\Sentry.AspNetCore.Grpc.Tests.csproj",
"test\\Sentry.AspNetCore.Tests\\Sentry.AspNetCore.Tests.csproj",
Expand Down
1 change: 1 addition & 0 deletions Sentry-CI-Test.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"solution": {
"path": "Sentry.sln",
"projects": [
"test\\Sentry.Android.Tests\\Sentry.Android.Tests.csproj",
"test\\Sentry.AspNet.Tests\\Sentry.AspNet.Tests.csproj",
"test\\Sentry.AspNetCore.Grpc.Tests\\Sentry.AspNetCore.Grpc.Tests.csproj",
"test\\Sentry.AspNetCore.Tests\\Sentry.AspNetCore.Tests.csproj",
Expand Down
7 changes: 7 additions & 0 deletions Sentry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Bindings.Android", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Bindings.Cocoa", "src\Sentry.Bindings.Cocoa\Sentry.Bindings.Cocoa.csproj", "{F533FD6D-1E10-4F06-BE3A-3B3C713A75A6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sentry.Android.Tests", "test\Sentry.Android.Tests\Sentry.Android.Tests.csproj", "{5E12E053-22AF-4184-8581-3FCFD225617D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -397,6 +399,10 @@ Global
{F533FD6D-1E10-4F06-BE3A-3B3C713A75A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F533FD6D-1E10-4F06-BE3A-3B3C713A75A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F533FD6D-1E10-4F06-BE3A-3B3C713A75A6}.Release|Any CPU.Build.0 = Release|Any CPU
{5E12E053-22AF-4184-8581-3FCFD225617D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5E12E053-22AF-4184-8581-3FCFD225617D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5E12E053-22AF-4184-8581-3FCFD225617D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5E12E053-22AF-4184-8581-3FCFD225617D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -460,6 +466,7 @@ Global
{70066C6C-0A18-4322-A02A-9A0DFE59C02B} = {77454495-55EE-4B40-A089-71B9E8F82E89}
{9A23DA57-3F0B-4646-A37A-71A4CE7C94CB} = {AF6AF4C7-8AA2-4D59-8064-2D79560904EB}
{F533FD6D-1E10-4F06-BE3A-3B3C713A75A6} = {AF6AF4C7-8AA2-4D59-8064-2D79560904EB}
{5E12E053-22AF-4184-8581-3FCFD225617D} = {83263231-1A2A-4733-B759-EEFF14E8C5D5}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0C652B1A-DF72-4EE5-A98B-194FE2C054F6}
Expand Down
1 change: 1 addition & 0 deletions SentryMaui.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"test\\MauiTestUtils\\DeviceTests.Runners.SourceGen\\TestUtils.DeviceTests.Runners.SourceGen.csproj",
"test\\MauiTestUtils\\DeviceTests.Runners\\TestUtils.DeviceTests.Runners.csproj",
"test\\MauiTestUtils\\DeviceTests\\TestUtils.DeviceTests.csproj",
"test\\Sentry.Android.Tests\\Sentry.Android.Tests.csproj",
"test\\Sentry.Extensions.Logging.Tests\\Sentry.Extensions.Logging.Tests.csproj",
"test\\Sentry.Maui.Device.TestApp\\Sentry.Maui.Device.TestApp.csproj",
"test\\Sentry.Maui.Tests\\Sentry.Maui.Tests.csproj",
Expand Down
1 change: 1 addition & 0 deletions SentryNoSamples.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"src\\Sentry.NLog\\Sentry.NLog.csproj",
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
"src\\Sentry\\Sentry.csproj",
"test\\Sentry.Android.Tests\\Sentry.Android.Tests.csproj",
"test\\Sentry.AspNet.Tests\\Sentry.AspNet.Tests.csproj",
"test\\Sentry.AspNetCore.Grpc.Tests\\Sentry.AspNetCore.Grpc.Tests.csproj",
"test\\Sentry.AspNetCore.Tests\\Sentry.AspNetCore.Tests.csproj",
Expand Down
23 changes: 23 additions & 0 deletions scripts/accept-verifier-changes.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Similar to `dotnet verify accept` but doesn't create new runtime-specific ".verified" files if a common one exists.
vaind marked this conversation as resolved.
Show resolved Hide resolved
param([switch] $DryRun)

Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"

$receivedFiles = Get-ChildItem . -Recurse -File -Include "*.received.txt"

$receivedFiles | ForEach-Object {
$nameWithRuntime = ($_.BaseName.Split(".") | Select-Object -SkipLast 1) -join "."
$nameWithoutRuntime = ($_.BaseName.Split(".") | Select-Object -SkipLast 2) -join "."
$ext = ".verified.txt"

$targetFile = (Test-Path "$($_.Directory)/$nameWithoutRuntime$ext") `
? "$($_.Directory)/$nameWithoutRuntime$ext" `
: "$($_.Directory)/$nameWithRuntime$ext"

Write-Host "Updating $($targetFile.Replace((Get-Item .).FullName, ''))"
if (-not ($DryRun))
{
Move-Item $_ $targetFile -Force
}
}
52 changes: 52 additions & 0 deletions scripts/update-test-apks.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
param([switch] $IfNotExist)

Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"

$repoRoot = "$PSScriptRoot/.."
$apkDir = "$repoRoot/test/Sentry.Android.Tests/TestAPKs"

New-Item -ItemType Directory -Force -Path $apkDir | Out-Null
$apkDir = Resolve-Path $apkDir

function BuildAndroidSample([bool] $UseAssemblyStore, [bool] $UseAssemblyCompression)
{
$sampleDir = "$repoRoot/samples/Sentry.Samples.Android"
$outputApk = "$apkDir/android-Store=$UseAssemblyStore-Compressed=$UseAssemblyCompression.apk"

if ($IfNotExist -and (Test-Path $outputApk))
{
Write-Host "$outputApk already exists, skipping build"
return
}

Push-Location -Verbose $sampleDir
try
{
# Need to do a clean build otherwise some DLLs would end up being compressed even if it's disabled on this run.
dotnet build --configuration Release --no-incremental `
--property:AndroidUseAssemblyStore=$UseAssemblyStore `
--property:AndroidEnableAssemblyCompression=$UseAssemblyCompression `
| Out-Host
if ($LASTEXITCODE -ne 0)
{
exit $LASTEXITCODE
}
}
finally
{
Pop-Location
}

Move-Item "$sampleDir/bin/Release/*/io.sentry.dotnet.samples.android-Signed.apk" $outputApk
}

if (!$IfNotExist)
{
Remove-Item "$apkDir/*.apk"
}

BuildAndroidSample $true $true
BuildAndroidSample $true $false
BuildAndroidSample $false $true
BuildAndroidSample $false $false
10 changes: 10 additions & 0 deletions src/Sentry/DebugImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ public sealed class DebugImage : IJsonSerializable
/// </summary>
public string? DebugId { get; set; }

/// <summary>
/// Checksum of the companion debug file.
/// </summary>
public string? DebugChecksum { get; set; }

/// <summary>
/// Path and name of the debug companion file.
/// </summary>
Expand All @@ -47,6 +52,8 @@ public sealed class DebugImage : IJsonSerializable
/// </summary>
public string? CodeFile { get; set; }

internal Guid? ModuleVersionId { get; set; }

/// <inheritdoc />
public void WriteTo(Utf8JsonWriter writer, IDiagnosticLogger? logger)
{
Expand All @@ -56,6 +63,7 @@ public void WriteTo(Utf8JsonWriter writer, IDiagnosticLogger? logger)
writer.WriteStringIfNotWhiteSpace("image_addr", ImageAddress);
writer.WriteNumberIfNotNull("image_size", ImageSize);
writer.WriteStringIfNotWhiteSpace("debug_id", DebugId);
writer.WriteStringIfNotWhiteSpace("debug_checksum", DebugChecksum);
writer.WriteStringIfNotWhiteSpace("debug_file", DebugFile);
writer.WriteStringIfNotWhiteSpace("code_id", CodeId);
writer.WriteStringIfNotWhiteSpace("code_file", CodeFile);
Expand All @@ -72,6 +80,7 @@ public static DebugImage FromJson(JsonElement json)
var imageAddress = json.GetPropertyOrNull("image_addr")?.GetString();
var imageSize = json.GetPropertyOrNull("image_size")?.GetInt64();
var debugId = json.GetPropertyOrNull("debug_id")?.GetString();
var debugChecksum = json.GetPropertyOrNull("debug_checksum")?.GetString();
var debugFile = json.GetPropertyOrNull("debug_file")?.GetString();
var codeId = json.GetPropertyOrNull("code_id")?.GetString();
var codeFile = json.GetPropertyOrNull("code_file")?.GetString();
Expand All @@ -82,6 +91,7 @@ public static DebugImage FromJson(JsonElement json)
ImageAddress = imageAddress,
ImageSize = imageSize,
DebugId = debugId,
DebugChecksum = debugChecksum,
DebugFile = debugFile,
CodeId = codeId,
CodeFile = codeFile,
Expand Down
Loading