Skip to content

[Documentation/clarification] AddInvalidMessage method with successful Result #35

Description

@nandos13

While attempting to resolve issue #32 in a forked repo, I came across something that may need clarification.

Result.AddInvalidMessage methods assign a Problem if it is null. This happens regardless of success state, which means that it's possible to have a successful Result which also has a Problem assigned. Additionally, some tests invoke this method on a successful Result, so it seems this is by design, but it feels like an oversight. It's unclear from the available documentation and readme file if this should be allowed.

If this is indeed an oversight, and successful results should not have a problem by design, then I am happy to continue implementing #32 and address this issue. Please advise if the methods should throw an exception when IsSuccess is true, or if silently failing is preferable.
Otherwise if this is by design, I think the readme and method documentation should be improved to explain valid cases where a successful result may also have a problem with validation issues, and how it is useful.

Cheers

Activity

  1. KSemenenko commented on Aug 18, 2025

    @KSemenenko
    Member

    I don’t think result can be successful and has problem at the small time. For me it doesn’t make sense, nice catch!

    Also please check https://github.com/managedcode/Communication/pull/39/files I realized we need interfaces for all this methods to make them consistent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions