-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Include file name in Contract failures #73092
Conversation
This adds the file names to the messages generated by contract failures. This information would've made it _significantly_ easier to debug a recent DDRIT failure.
@CyrusNajmabadi want to make sure you saw this PR as you added the |
@@ -48,11 +49,11 @@ internal static partial class Contract | |||
/// all builds | |||
/// </summary> | |||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | |||
public static void ThrowIfNull<T>([NotNull] T value, string message, [CallerLineNumber] int lineNumber = 0) | |||
public static void ThrowIfNull<T>([NotNull] T value, string message, [CallerLineNumber] int lineNumber = 0, [CallerFilePath] string? filePath = null) |
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.
Note: the filePath
is last specifically to avoid ambiguities with Contract
methods that take an explicit string message
like this one.
Sounds great! |
What was the error btw? |
Test failure is a known flaky issue. |
This adds the file names to the messages generated by contract failures. This information would've made it significantly easier to debug a recent DDRIT failure.