getsentry / sentry-native

Sentry SDK for C, C++ and native applications.
MIT License
400 stars 169 forks source link

Crashpad not capturing invalid_parameter errors on Windows #327

Open maxp1256 opened 4 years ago

maxp1256 commented 4 years ago

Description I'm trying to catch an error with sentry/crashpad, but it's not detecting it. Should sentry being called through invoke_watson or could this exception type not be handled by sentry/crashpad? Are there any possibilities to debug the crashpad-handler / Windows Error Reporting?

When does the problem happen

Environment

Issue A messagebox (from windows) is showing that our app stopped working.

Callstack of our app: ucrtbase.dll!invoke_watson() Unknown ucrtbase.dll!__invalid_parameter() Unknown ucrtbase.dll!invalid_parameter_noinfo() Unknown ucrtbase.dll!crt_stdio_output::output_processor<char,crt_stdio_output::string_output_adapter,crt_stdio_output::standard_base<char,crt_stdio_output::string_output_adapter>>::state_case_size() Unknown ucrtbase.dll!___stdio_common_vsprintf() Unknown [Inline Frame] ourapp.exe!_vsnprintf_l(unsigned char const) Line 1390 C [Inline Frame] ourapp.exe!_vsprintf_l(unsigned char const) Line 1462 C

Expected behavior Sentry catches the Exception and our app quits.

Mixaill commented 4 years ago

Looks like Crashpad backend does not call _set_invalid_parameter_handler() https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/set-invalid-parameter-handler-set-thread-local-invalid-parameter-handler?view=vs-2019

jan-auer commented 4 years ago

Linking this thread for visibility, where we were discussing the same for the Breakpad backend: https://github.com/getsentry/sentry-native/pull/290#issuecomment-642227678

Interestingly, Electron ignores it, too. See here.