Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSAssertionHandler #1973

Closed
lhunath opened this issue Jul 14, 2022 · 10 comments
Closed

NSAssertionHandler #1973

lhunath opened this issue Jul 14, 2022 · 10 comments

Comments

@lhunath
Copy link
Contributor

lhunath commented Jul 14, 2022

Problem Statement

We see crash logs coming in that have clearly been the result of a failed assertion, but no information is included in the report to aid us in determining which assertion failed or why the assert fell through.

In cases where NSAssertionHandler is involved, additional details may get logged through NSLog but these are not captured by Sentry.

image

Solution Brainstorm

  • Sentry could install a custom NSAssertionHandler.
  • Sentry could swizzle the handleFailure methods of the assertion handler.
@brustolin
Copy link
Contributor

This sounds like a good idea. We need to investigate how much information we can get out of this.

@philipphofmann
Copy link
Member

We already have support for support for fatalError, assert, precondition with #662.

@lhunath
Copy link
Contributor Author

lhunath commented Jul 20, 2022

I'd say for me, the primary value of NSAssertHandler is to gracefully document the various potential Apple internal asserts. Although others might use NSAssert themselves in Obj-C code. Typically these are deactivated in production but very useful during development & testing.

@kevinrenskers kevinrenskers self-assigned this Aug 31, 2022
@kevinrenskers
Copy link
Contributor

@philipphofmann @lhunath I am not totally sure what this issue aims to solve. We already support assert, they get logged in Sentry with the error message and all. Is this for when somebody installs a custom NSAssertionHandler in an Obj-C app? Does that stop our code from handling it?

@lhunath do you have a minimal example repo that shows the problem you want solved?

@philipphofmann
Copy link
Member

philipphofmann commented Oct 3, 2022

@lhunath, can you please give us some sample code on how you would expect our SDK to handle your feature request?

@philipphofmann philipphofmann moved this from Needs Investigation to Needs More Information in Mobile & Cross Platform SDK Oct 5, 2022
@lhunath
Copy link
Contributor Author

lhunath commented Oct 18, 2022

@kevinrenskers I apologize, I can't be of huge help – my primary aim was to avoid the issue described in the screenshot; ie. void of any context about the assert that triggered the crash. I do not know why this issue was logged as-is if, as you say, "asserts already get logged in Sentry with the error message and all". This was not my experience. Unfortunately, I can no longer find the issue at hand. I can confirm that my project does /not/ have any custom NSAssertionHandlers installed, nor does it use any libraries that would (Sentry aside).
Feel free to close if you feel there is nothing to do here; though note that the screenshot issue was still generated and likely shouldn't have been, according to your claim.

@kevinrenskers
Copy link
Contributor

If you could supply sample code that reproduces the problem that would be a great help to fix and close this issue.

@lhunath
Copy link
Contributor Author

lhunath commented Oct 18, 2022

I will keep a look out for a way to reproduce the issue and return, since at this point I don't have one.

@philipphofmann
Copy link
Member

Any updates @lhunath?

@kevinrenskers
Copy link
Contributor

We are going to close this issue for now, but we can reopen this if you have a way to reproduce the issue, @lhunath.

Repository owner moved this from Needs More Information to Done in Mobile & Cross Platform SDK Nov 29, 2022
@kevinrenskers kevinrenskers removed their assignment Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

4 participants