Skip to content

Commit 3f03ca1

Browse files
committed
docs(WalletBase): note SignMessage(null) overload ambiguity
CodeRabbit flagged that adding SignMessage(string) creates a CS0121 overload-resolution ambiguity for callers passing a literal null, since null is implicitly convertible to both byte[] and string. The runtime null guard already throws ArgumentNullException for the string overload, and the byte[] overload predates this PR, so renaming would break the expected C# overload pattern. Documented the limitation per CodeRabbit's first suggestion so external consumers know to cast (byte[])null or (string)null when they need to.
1 parent e7d3f9a commit 3f03ca1

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Runtime/codebase/WalletBase.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,13 @@ public virtual async Task<RequestResult<string>> SignAndSendTransaction
270270
/// </summary>
271271
/// <param name="message">The string message to sign</param>
272272
/// <returns>The signature bytes</returns>
273+
/// <remarks>
274+
/// This overload coexists with <see cref="SignMessage(byte[])"/>. Passing a
275+
/// literal <c>null</c> (e.g. <c>SignMessage(null)</c>) is ambiguous between
276+
/// the two overloads at compile time (CS0121); cast to <c>(byte[])null</c>
277+
/// or <c>(string)null</c> to disambiguate. Typed variables and non-null
278+
/// string/byte[] expressions are unaffected.
279+
/// </remarks>
273280
public Task<byte[]> SignMessage(string message)
274281
{
275282
if (message == null) throw new ArgumentNullException(nameof(message));

0 commit comments

Comments
 (0)