0

I'm using Sentry to collect exceptions from a Unity Engine app. In some cases, it's possible to cause an exception every frame, i.e. 60+ times per second. Sentry logs all of these events individually. I want to limit the number of times the "same" exception is logged.

What would be a reliable way to determine if two instances of System.Exception are produced at the same location in the program? Obviously, I could use the file name and line number, but this information is only available in Debug builds. Is there any alternative for release builds?

I'm looking at StackTrace and StackFrame, but I can't find a unique identifier of the exception location, that is available in Release.

Jawap
  • 2,463
  • 3
  • 28
  • 46
  • 2
    Even if you *do* have a file and line number, multiple independent problems can be caused from a single line of code. – Servy Jun 18 '19 at 18:57
  • @Servy That's certainly true, but in this case I'm willing to lose that information to avoid being flooded with exceptions. – Jawap Jun 18 '19 at 19:01
  • 1
    Can you not just string compare the stacktrace (and any inner exceptions also)? May have to take a performance hit though. – the.Doc Jun 18 '19 at 19:01
  • You can deploy the .pdb for a release build. Line number is about as good as you can get. See: https://stackoverflow.com/questions/628565/display-lines-number-in-stack-trace-for-net-assembly-in-release-mode – Broots Waymb Jun 18 '19 at 19:02

0 Answers0