-
Notifications
You must be signed in to change notification settings - Fork 85
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
Auto-debug ExtCitizenInstanceManager.StartPathFind() #834
Conversation
If an exception occurs in `StartPathFind()` we don't get much information in the logs to help us determine what caused it. This commit tries to remedy that by intercepting the exception then checking a `TernaryBool` (TB): * `Undefined` = Set the TB to `True` * `True` = Set the TB to `False` * `False` = Do nothing The original exception is then rethrown. When the TB is `True`, the internal debug logging (all of it) is enabled for the next invocation of `StartPathFind()` which will dump all sorts of useful info to the `TMPE.log` file. When an exception occurs, it's usually recurrent on subsequent calls to `StartPathFind()` so hopefully the debug logging will give us insight in to what specifically caused the problem.
Actually, I can just repeat the call to the internal method to debug the specific params that caused the error... update incoming... |
Rather than debugging the subsequent invocation, just repeat the current one (the one that failed) but with debugging enabled.
Most of the logging was previously filtered in non-`DEBUG` builds. This commit changes that to ensure the logging is always present, even in `RELEASE` builds, but only occurs if the relevant logging toggles are `true`. Downside is that there are now lots of checks for those toggles.
Make sure only one set of trace goes in to log, and reduce amount of stack tracing. Log should be a bit easier to digest now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
User will see error dialog per error anyway, so might as well do the full debug log per error to get more info.
I've updated this so now it does the logging on each occurrence of the error, simplifying state management in the process. User has to click on-screen error box anyway so they won't be caring about split second it takes to do the full debug log. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, added info how to fix null ref
Unity has weird `==` operator, that returns fake null - see: https://blogs.unity3d.com/2014/05/16/custom-operator-should-we-keep-it/ More details in #834 (review)
@krzychu124 is this ok for merge? |
Fixes #840
If an exception occurs in
StartPathFind()
we don't get much information in the logs to help us determine what specifically caused it.This commit tries to remedy that by intercepting the exception, then repeating the
StartPathFind()
only this time with full debug logging. The original exception is then rethrown.The only performance overheads during normal operation should be:
try .. catch
true|false
on each invocation (previously they wereconst
andfalse
inRELEASE
builds.)if (logParkingAi) { ... }
), one for each log callInternalStartPathFind()
only a few will be encountered.Hopefully the performance impacts will be negligible, but that remains to be tested.
This PR is result of by Nijamods (ninjanoobslayer) issue report in #825 (comment) and subsequent log files in #825 (comment) . I've sent a build of TMPE with this modification to Ninja to test so we should know if it works with followup in #825.