From 559822c67cde206e0f54a75fee0210f2a3e55700 Mon Sep 17 00:00:00 2001
From: Chris Wolfgang <210299580+Chris-Wolfgang@users.noreply.github.com>
Date: Thu, 16 Apr 2026 09:05:15 -0400
Subject: [PATCH 1/2] Fix XML doc typos, stale TODOs, and exception message
wording
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Result.cs:
- Fix "error errorMessage" → "error message" in constructor docs and
exception messages
- Fix extra > in > (3 occurrences)
- Use and in XML doc remarks
- Fix missing article: "will contain message" → "will contain a message"
Try.cs:
- Add missing periods to doc comments
- Remove trailing whitespace from text
- Fix spacing: 3 blank lines between Run and RunAsync
- Remove trailing blank lines at end of file
Tests:
- Remove stale TODO comments from RunFuncTests and RunAsyncFuncTests
Verified: 0 warnings, 96 tests pass, ReSharper inspectcode clean
Co-Authored-By: Claude Opus 4.6 (1M context)
---
src/Wolfgang.TryPattern/Result.cs | 28 ++++++++++---------
src/Wolfgang.TryPattern/Try.cs | 12 +++-----
.../RunAsyncFuncTests.cs | 2 +-
.../Wolfgang.TryPattern.Tests/RunFuncTests.cs | 2 +-
4 files changed, 21 insertions(+), 23 deletions(-)
diff --git a/src/Wolfgang.TryPattern/Result.cs b/src/Wolfgang.TryPattern/Result.cs
index ef94eb9..c88fc5f 100644
--- a/src/Wolfgang.TryPattern/Result.cs
+++ b/src/Wolfgang.TryPattern/Result.cs
@@ -18,10 +18,10 @@ public class Result
///
/// A value indicating whether the operation succeeded. Set to
/// if the operation was successful; otherwise, .
- /// Error errorMessage associated with the result.
+ /// Error message associated with the result.
///
- /// If the operation was successful, errorMessage must be an empty string. If the operation failed
- /// errorMessage must not be null or empty
+ /// If the operation was successful, must be an empty string. If the operation failed,
+ /// must not be null or empty.
///
protected Result
(
@@ -32,10 +32,10 @@ protected Result
switch (succeeded)
{
case true when errorMessage != string.Empty:
- throw new ArgumentException("A successful result cannot have an error errorMessage.", nameof(errorMessage));
+ throw new ArgumentException("A successful result cannot have an error message.", nameof(errorMessage));
case false when string.IsNullOrWhiteSpace(errorMessage):
- throw new ArgumentException("A failed result must have an error errorMessage.", nameof(errorMessage));
+ throw new ArgumentException("A failed result must have an error message.", nameof(errorMessage));
default:
Succeeded = succeeded;
@@ -59,7 +59,7 @@ public static Result Failure(string errorMessage) =>
///
- /// Creates a successful >.
+ /// Creates a successful .
///
public static Result Success() => new(true, string.Empty);
@@ -124,7 +124,7 @@ public static Result Flatten(params Result[] results)
/// Returns true if any of the specified s indicate a failure.
/// Otherwise, false.
///
- /// The array of > to review
+ /// The array of to review.
///
/// if any of the specified s failed, otherwise .
///
@@ -137,7 +137,7 @@ public static bool AnyFailed(params Result[]? results) =>
///
/// Returns true if all the specified s indicate success.
///
- /// The array of > to review
+ /// The array of to review.
///
/// if all the specified s succeeded, otherwise .
///
@@ -151,7 +151,7 @@ public static bool AllSucceeded(params Result[]? results) =>
///
/// The result of executing an . Contains properties indicating whether the operation
/// or . If the operation failed the
-/// property will contain message as to why. If the operation succeeded the
+/// property will contain a message as to why. If the operation succeeded the
/// property will contain the return value from the function.
///
public class Result : Result
@@ -171,11 +171,13 @@ public class Result : Result
///
/// A value indicating whether the operation succeeded. Set to
/// if the operation was successful; otherwise, .
- /// Error errorMessage associated with the result.
- /// The return value of the function if it succeeded, otherwise the default value for {T}
+ /// Error message associated with the result.
+ /// The return value of the function if it succeeded, otherwise the default value for .
///
- /// If the operation was successful, errorMessage must be an empty string and value should be the return value from the function.
- /// If the operation failed errorMessage must not be null or empty and the value should be default{T}
+ /// If the operation was successful, must be an empty string and
+ /// should be the return value from the function.
+ /// If the operation failed, must not be null or empty and
+ /// should be default(T).
///
#if NET5_0_OR_GREATER
private Result(bool succeeded, string? errorMessage, T? value) : base(succeeded, errorMessage) => _value = value;
diff --git a/src/Wolfgang.TryPattern/Try.cs b/src/Wolfgang.TryPattern/Try.cs
index a7dee81..614ff0d 100644
--- a/src/Wolfgang.TryPattern/Try.cs
+++ b/src/Wolfgang.TryPattern/Try.cs
@@ -16,7 +16,7 @@ public static class Try
///
/// The action to execute.
///
- /// A that indicates if the action was successful
+ /// A that indicates if the action was successful.
///
public static Result Run(Action action)
{
@@ -44,7 +44,7 @@ public static Result Run(Action action)
/// The action to execute.
/// The CancellationToken to monitor.
///
- /// A of representing the asynchronous operation
+ /// A of representing the asynchronous operation.
///
public static async Task RunAsync(Action action, CancellationToken token = default)
{
@@ -77,7 +77,7 @@ public static async Task RunAsync(Action action, CancellationToken token
/// The function to execute.
///
/// A indicating if the function was successful or not and the result of
- /// the function if it was.
+ /// the function if it was.
///
#if NET5_0_OR_GREATER
public static Result Run(Func function)
@@ -116,6 +116,7 @@ public static Result Run(Func? function)
#endif
+
///
/// Executes the specified function, catching any exception that may occur.
///
@@ -170,9 +171,4 @@ public static async Task> RunAsync(Func> function, Cancella
}
}
#endif
-
-
-
-
}
-
diff --git a/tests/Wolfgang.TryPattern.Tests/RunAsyncFuncTests.cs b/tests/Wolfgang.TryPattern.Tests/RunAsyncFuncTests.cs
index 27fe045..b6e6205 100644
--- a/tests/Wolfgang.TryPattern.Tests/RunAsyncFuncTests.cs
+++ b/tests/Wolfgang.TryPattern.Tests/RunAsyncFuncTests.cs
@@ -4,7 +4,7 @@
#endif
namespace Wolfgang.TryPattern.Tests;
-public class RunAsyncFuncTests // TODO Rename class and file
+public class RunAsyncFuncTests
{
[Fact]
public async Task RunAsync_Func_when_passed_null_throws_ArgumentNullException()
diff --git a/tests/Wolfgang.TryPattern.Tests/RunFuncTests.cs b/tests/Wolfgang.TryPattern.Tests/RunFuncTests.cs
index f9ef3b1..296c48a 100644
--- a/tests/Wolfgang.TryPattern.Tests/RunFuncTests.cs
+++ b/tests/Wolfgang.TryPattern.Tests/RunFuncTests.cs
@@ -3,7 +3,7 @@
#endif
namespace Wolfgang.TryPattern.Tests;
-public class RunFuncTests // TODO Rename class and file
+public class RunFuncTests
{
[Fact]
public void Run_Func_WithNullFunction_ThrowsArgumentNullException()
From a242edcd52f47b2972b81187db9d0a933f003df1 Mon Sep 17 00:00:00 2001
From: Chris Wolfgang <210299580+Chris-Wolfgang@users.noreply.github.com>
Date: Fri, 17 Apr 2026 20:01:25 -0400
Subject: [PATCH 2/2] Address Copilot review: document whitespace rejection in
remarks
The constructor uses IsNullOrWhiteSpace but the XML remarks only
mentioned null/empty. Add "or whitespace" to both Result and
Result constructor remarks.
Co-Authored-By: Claude Opus 4.6 (1M context)
---
src/Wolfgang.TryPattern/Result.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Wolfgang.TryPattern/Result.cs b/src/Wolfgang.TryPattern/Result.cs
index c88fc5f..9499b57 100644
--- a/src/Wolfgang.TryPattern/Result.cs
+++ b/src/Wolfgang.TryPattern/Result.cs
@@ -21,7 +21,7 @@ public class Result
/// Error message associated with the result.
///
/// If the operation was successful, must be an empty string. If the operation failed,
- /// must not be null or empty.
+ /// must not be null, empty, or whitespace.
///
protected Result
(
@@ -176,7 +176,7 @@ public class Result : Result
///
/// If the operation was successful, must be an empty string and
/// should be the return value from the function.
- /// If the operation failed, must not be null or empty and
+ /// If the operation failed, must not be null, empty, or whitespace and
/// should be default(T).
///
#if NET5_0_OR_GREATER