WIP: feat: WER integration#1837
Conversation
Adds a sentry_integration_t struct with a register_func callback that is called from sentry_init() while the scope lock is held. Integrations can use this to create and register scope observers. sentry_options_add_integration() stores integrations in options, which takes ownership. An optional free_func is called before the integration struct is freed.
Adds sentry_integration_wer_new() which creates an integration that uses a scope observer to sync sentry scope state to Windows Error Reporting: - Tags are synced via WerRegisterCustomMetadata (loaded dynamically for compatibility with pre-19H1 Windows 10 builds). - File attachments are registered with WerRegisterFile. - Buffer attachments are registered with WerRegisterMemoryBlock. When tags or attachments are removed via the sentry API, the corresponding WER registrations are cleaned up.
Replace the generic sentry_integration_t approach with a simpler pattern matching the existing Qt integration (SENTRY_INTEGRATION_QT): - Remove sentry_integration_t, sentry_options_add_integration(), and all the dynamic array management in options. - Add a SENTRY_INTEGRATION_WER CMake option that conditionally compiles the WER integration source and sets the compile definition. - sentry_integration_setup_wer(scope, options) is called from sentry_init() inside SENTRY_WITH_SCOPE_MUT. - The WER integration uses static globals for wer.dll function pointers instead of a heap-allocated state struct.
The source file is already guarded with #ifdef SENTRY_PLATFORM_WINDOWS, so it quietly becomes a no-op on other platforms without needing a FATAL_ERROR.
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
### Features
- WER integration ([#1837](https://github.com/getsentry/sentry-native/pull/1837))If none of the above apply, you can opt out of this check by adding |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit de2ad2d. Configure here.
| observer->remove_attachment = wer_remove_attachment; | ||
|
|
||
| sentry__scope_add_observer(scope, observer); | ||
| } |
There was a problem hiding this comment.
Pre-init attachments skip WER
High Severity
During sentry_init, attachments from sentry_options_add_attachment are moved onto the global scope before WER setup registers its observer, and no add_attachment notifications run for that list. Those files never reach WerRegisterFile / WerRegisterMemoryBlock, so WER crash reports miss attachments that Sentry and crash backends still include.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit de2ad2d. Configure here.
| sentry_scope_set_level(sentry_scope_t *scope, sentry_level_t level) | ||
| { | ||
| scope->level = level; | ||
| SENTRY_NOTIFY_OBSERVERS(scope, set_level, level); |
There was a problem hiding this comment.
Scope attach skips observers
Medium Severity
sentry_scope_attach_file_n and sentry_scope_attach_bytes_n append to the scope attachment list without SENTRY_NOTIFY_OBSERVERS, while WER integration only reacts to add_attachment callbacks. Attachments added through the public scope attach APIs on the global scope are omitted from WER even though they are sent with Sentry events.
Reviewed by Cursor Bugbot for commit de2ad2d. Configure here.


Warning
WIP 🚧🔨⏳⛔
The WER (Windows Error Reporting) integration:
cmake -DSENTRY_INTEGRATION_WER=ON(inspired by the existing Qt integration)sentry_initsentry_scope_observer_t, also WIP)WerRegisterCustomMetadata/WerUnregisterCustomMetadata(Windows 10 1703+)WerRegisterFile/WerUnregisterFileWerRegisterMemoryBlock/WerUnregisterMemoryBlock