firebase / firebase/quickstart-unity
FR: Run Logged Exception Handling Off Thread
- Dominant language
- C#
- Stars
- 923
- Forks
- 456
- PR merge metrics
- No merged PRs in 30d
Description
### Feature proposal
* Firebase Component: Crashlytics
When the `Firebase.Crashlytics.LoggedException` class is created it runs a lot of Regex matches on the stacktrace. This can take several milliseconds, 15ms on an iPhone 8 in an example I profiled.

`Firebase.Crashlytics.ExceptionHandler` registers a listener to `Application.logMessageReceived` on app startup and creates an instance of that LoggedException for every logged exception on the main thread. This can create a frame spike in our application.
In our application we also forward logged error messages to `Firebase.Crashlytics.Crashlytics.LogException` by listening to `Application.logMessageReceived`, but we push those messages off the main thread and trigger the logging from there. That appears to work without issues, so I'm assuming all the supporting infrastructure is thread safe.
Ideally there would be an option to either:
1. Not have the ExceptionHandler register the logMessageReceived handler so we could manually push in the exceptions off thread
2. Have the ExceptionHandler process the exceptions off the main thread.
Contributor guide
Research direction
Start by tracing Firebase.Crashlytics.ExceptionHandler, Firebase.Crashlytics.LoggedException, and the Application.logMessageReceived listener described in the report. Compare this with the existing off-thread use of Crashlytics.LogException and verify the supporting APIs' thread-safety assumptions. Done means providing a supported way to avoid main-thread stacktrace processing without introducing frame spikes or broken exception reporting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, firebase, unity
- Domain
- game-dev, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100