Replies: 1 comment 1 reply
-
Sounds like a good improvement to harden the code. Would you like to submit a PR? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm logging errors in my application with Serilog. When a DataPortalException occurs I pass the exception to Serilog with a call Log.Error(ex, "some message"). This often, if not all the time, results in a NullReferenceException in this bit of code in DataPortalException:
public DataPortalErrorInfo BusinessErrorInfo { get { var result = ErrorInfo; while (result.InnerError != null) result = result.InnerError; return result; } }
ErrorInfo is null, thus the NullReferenceException. I note that DataPortalException.ToString() checks ErrorInfo for null -- shouldn't that be happening in the BusinessErrorInfo property as well?
Beta Was this translation helpful? Give feedback.
All reactions