Skip to content

Improve nullable annotation on CancelInvocationMessage.InvocationId #63083

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AArnott
Copy link
Contributor

@AArnott AArnott commented Aug 3, 2025

This declares a new property for string InvocationId { get; } so that the compiler sees it as non-nullable, consistent with the constructor declared on the same type.

@github-actions github-actions bot added the area-signalr Includes: SignalR clients and servers label Aug 3, 2025
@AArnott AArnott force-pushed the AArnott-patch-1 branch 3 times, most recently from aa49469 to abdf55c Compare August 3, 2025 21:14
This declares a `new` property for `string InvocationId { get; }` so that the compiler sees it as non-nullable, consistent with the constructor declared on the same type.
@AArnott AArnott marked this pull request as ready for review August 4, 2025 03:43
@Copilot Copilot AI review requested due to automatic review settings August 4, 2025 03:43
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves nullable reference type annotations for the CancelInvocationMessage.InvocationId property by declaring a new property that explicitly returns a non-nullable string, consistent with the class constructor that requires a non-null invocation ID parameter.

  • Adds a new property declaration that overrides the base property with non-nullable annotation
  • Updates public API documentation across multiple target frameworks to reflect the API change

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/SignalR/common/SignalR.Common/src/Protocol/CancelInvocationMessage.cs Adds new non-nullable InvocationId property override
src/SignalR/common/SignalR.Common/src/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt Documents API change for .NET Standard 2.0
src/SignalR/common/SignalR.Common/src/PublicAPI/net462/PublicAPI.Unshipped.txt Documents API change for .NET Framework 4.6.2
src/SignalR/common/SignalR.Common/src/PublicAPI/net10.0/PublicAPI.Unshipped.txt Documents API change for .NET 10.0

@@ -17,4 +17,7 @@ public class CancelInvocationMessage : HubInvocationMessage
public CancelInvocationMessage(string invocationId) : base(invocationId)
{
}

/// <inheritdoc cref="HubInvocationMessage.InvocationId" />
public new string InvocationId => base.InvocationId!;
Copy link
Preview

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

The XML documentation comment should be more descriptive than just inheriting from the base class. Since this property provides stronger null safety guarantees than the base property, the documentation should explain this improvement and include proper XML doc tags like <summary> instead of just <inheritdoc cref="..."/>.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-signalr Includes: SignalR clients and servers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant