getsentry / getsentry/sentry-dart
Calling Sentry capture methods within a new Isolate does not work
- Dominant language
- Dart
- Stars
- 873
- Forks
- 299
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 30
Description
### Description
Works fine:
```
throwingClosure(String message) async {
throw StateError(message);
}
final isolate = await Isolate.spawn(throwingClosure, "message", paused: true);
isolate.addSentryErrorListener();
isolate.resume(isolate.pauseCapability!);
```
Does not work:
```
throwingClosure(String message) async {
Sentry.captureException(message);
}
final isolate = await Isolate.spawn(throwingClosure, "message", paused: true);
isolate.addSentryErrorListener();
isolate.resume(isolate.pauseCapability!);
```
In this case, when you call any capture method, the `Hub` is `NoOpHub`, it's like the SDK isn't initialized within a different isolate, most likely because isolates are isolated :D and don't share any memory.
Contributor guide
Assessment
This issue has not been assessed yet.