MindscapeHQ / raygun4net

Raygun provider for .NET
https://raygun.com
MIT License
125 stars 91 forks source link

Add Portable PDB support to Raygun4Net and Raygun4NetCore #528

Closed xenolightning closed 6 months ago

xenolightning commented 6 months ago

This captures the required debugging information for reversing the stacktrace line numbers and file from the stack trace when a PDB is not included in the build output

Updated payload:

image

xenolightning commented 6 months ago

:shipit:

1Q: the offset is -1, if the try fails and -1 is set but we have other info what happens to the offset? Do we ignore if the offset is -1?

Yeah I wanted a non-sensical value for determining that it doesn't exist. What I might do is set it to the constant. Which is equal to -1 :D

https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.stackframe.offset_unknown?view=net-8.0

ProRedCat commented 6 months ago

I am happy with this, it works for MAUI (iOS and Android tested) with the traces being symbolicated when using Sean's tool

image

One thing we noticed was that if any program is created without PDB files, the IL offsets will cause the symbolicated trace to be off by one line. This is not an issue as it's undefined behaviour to build an app and then build the PDB separately.

xenolightning commented 6 months ago

Holding on this just for now, we may need to add more information to the "frame" that we can use to determine what PDB we should be looking at, maybe that's assembly, or some sort of signature - not sure yet

xenolightning commented 6 months ago

There is issues using the PEReader in the context of the Android platform. Xamarin has some code to read assemblies out of the blob

We are going to need to explore this code, and probably port it into Raygun4Net to capture the PDB signatures when targeting android

https://github.com/xamarin/xamarin-android/tree/main/tools/assembly-store-reader

xenolightning commented 6 months ago

Raw report inside raygun, after collecting the new fields. The full pipeline supports these fields. They haven't been reversed in the screenshots, but we have the data to do the reversal!

image image

xenolightning commented 6 months ago

Tagged @QuantumNightmare on this one too, as he had suggestions on improving the payload

xenolightning commented 6 months ago

Last 3 commits look good to me, just commented on what looks like a typo. Would be good to avoid the duplicate code too, but that could be left for another round as I know there are already thoughts on simplifying the repository.

Yeah, we end up having to make changes to both framework and core sadly.

We do have plans to consolidate them into a single netstandard targeting lib at some point soon

phillip-haydon commented 6 months ago

Don't forget to update the Change Log.

xenolightning commented 6 months ago

Don't forget to update the Change Log.

I'll do a larger changelog update for 11.0 which will also include the offline storage support for netcore

xenolightning commented 6 months ago

Going to merge and release as 11.0-pre1

Then we can base raygun4maui off this package, and bring the rest into line