Skip to content

DelayedConstraint shows full result of underlying constraint. - #4922

Merged
manfred-brands merged 4 commits into
mainfrom
Issue4909_PropertiesWriter
Jan 12, 2025
Merged

manfred-brands merged 4 commits into
mainfrom
Issue4909_PropertiesWriter

Conversation

@manfred-brands

@manfred-brands manfred-brands commented Jan 10, 2025 •

Copy link
Copy Markdown
Member

Fixes #4909
Fixes #4919
Fixes #4545

@manfred-brands
manfred-brands force-pushed the Issue4909_PropertiesWriter branch from ed559fa to 0071137 Compare January 10, 2025 07:50

@stevenaw stevenaw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @manfred-brands
I hadn't time to properly review tonight, but I suspect you may've fixed a third bug too here 🙂

public override void WriteMessageTo(MessageWriter writer)
{
writer.WriteMessageLine(Description);
_innerResult.WriteMessageTo(writer);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting this PR up @manfred-brands

I haven't tested this myself, but I suspect this may also fix #4545
Not that I am suggesting we explicitly pursue it in this PR if it doesn't, merely that we may get a third bug fix "for free" from your changes

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are good at finding issues. Unknowingly I followed a similar solution as described in that ticket.

@OsirisTerje OsirisTerje left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Checked the tests.

@stevenaw stevenaw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @manfred-brands ! This looks great to me too.
I left one minor suggestion to make the new MsgUtils method private unless there was a use case you knew of to keep it public

/// </summary>
/// <param name="val">The object to format.</param>
/// <returns>Formatted string for all properties.</returns>
public static string FormatValueProperties(object? val)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Was there a use case for making this public, or could it be made private to maximize our ability to evolve it without breaking others?

For example, there could be a time in the future where we'd want to pass in a precomputed collection of properties from elsewhere in the framework, or perhaps allowing this to recurse to child objects with a configurable "depth".

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Was there a use case for making this public, or could it be made private to maximize our ability to evolve it without breaking others?

It cannot be private as it is called from another class (EqualConstraintResult). I didn't want to introduce it in the formatter call chain for all values as that will have side effects where properties are not to be printed, like DbContext.

The whole class MsgUtils is internal and therefore we can change the signature without breaking external code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! I had meant internal, but has missed that MsgUtils itself was already internal. Sorry about that

@manfred-brands
manfred-brands force-pushed the Issue4909_PropertiesWriter branch from aafc1ca to 8b91299 Compare January 12, 2025 00:23
@manfred-brands
manfred-brands merged commit 6ed875d into main Jan 12, 2025
@manfred-brands
manfred-brands deleted the Issue4909_PropertiesWriter branch January 12, 2025 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants