sentry-cocoa icon indicating copy to clipboard operation
sentry-cocoa copied to clipboard

Decode Swift type names

Open lhunath opened this issue 3 years ago • 6 comments

Problem Statement

Our error reports are full of mentions such as:

EXC_BAD_ACCESS _TtCVV8HubstaffP33_25DEF6E1EA93D46FE809017E6DD99DCF21NavigatingStackScreen30NavigationBarConfigurationView14ViewController

This is very user-unfriendly and there is no reason to leave obfuscated type names in public-facing titles like this. It would be great if Sentry could decode these type names into something more user-friendly.

Solution Brainstorm

Here's some code to kick-start you on this journey: https://gitlab.com/spectre.app/ios/-/blob/main/Sources/Util/Describe.swift#L34

lhunath avatar Jul 14 '22 15:07 lhunath

Routing to @getsentry/team-mobile for triage. ⏲️

getsentry-release avatar Jul 15 '22 16:07 getsentry-release

Hello @lhunath. We are aware of this and are working to resolve it.

brustolin avatar Jul 18 '22 07:07 brustolin

So far Sentry only does demanging on the server through symbolic. @brustolin is exploring a way to demangle client side but we're afraid that might bloat the SDK, unsure at this point.

bruno-garcia avatar Jul 20 '22 12:07 bruno-garcia

What is the rationale to do this client side vs server side?

armcknight avatar Aug 02 '22 22:08 armcknight

do you need access to the runtime for reflection? I wouldn't expect so.

lhunath avatar Aug 02 '22 23:08 lhunath

What is the rationale to do this client side vs server side?

Flexibility. We don't need to wait for a server side update every time we use a class name in a description or extra information.

Local log during debug.

And @bruno-garcia mentioned something about this being necessary for Dynamic Sampling.

do you need access to the runtime for reflection? I wouldn't expect so.

Nope. The mangled name has a logic, we just need to parse it.

You can follow all the findings in this PR #2033

brustolin avatar Aug 04 '22 07:08 brustolin

This was done in #2162, which is part of the upcoming 8.0.0 release. You can test the beta version of this release already.

kevinrenskers avatar Dec 07 '22 09:12 kevinrenskers