Skip to content
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

[BUG] Service Bus is not annotated for nullability #42192

Closed
vanillajonathan opened this issue Feb 26, 2024 · 6 comments
Closed

[BUG] Service Bus is not annotated for nullability #42192

vanillajonathan opened this issue Feb 26, 2024 · 6 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Bus

Comments

@vanillajonathan
Copy link

Library name and version

Azure.Messaging.ServiceBus 7.17.3

Describe the bug

The ContentType property of the ServiceBusReceivedMessage class is not declared as nullable but it can be null.

Expected behavior

The ContentType property should be declared as nullable.

public string? ContentType { get; set; }

Actual behavior

The ContentType property is not declared as nullable.

public string ContentType { get; set; }

Reproduction Steps

var message = await _receiver.PeekMessageAsync(123);
if (message.ContentType.StartsWith("application/"))
{
}

Environment

.NET 8.0.200

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-triage Workflow: This issue needs the team to triage. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Bus labels Feb 26, 2024
@jsquire jsquire self-assigned this Feb 26, 2024
@jsquire jsquire changed the title [BUG] [BUG] Service Bus is not annotated for nullability Feb 26, 2024
@jsquire
Copy link
Member

jsquire commented Feb 26, 2024

Hi @vanillajonathan. Thank you for reaching out and we regret that you're experiencing difficulties. The Service Bus client library is intentionally not annotated for nullability. Nullable reference annotations are something that we continue to evaluate for Azure SDK packages as the language and tooling evolves, but not something that we'll be enabling in the short term. There are several reasons for this, the most important being:

  • The Azure SDK strives to have a consistent set of patterns and feel across different libraries. As such, nullable reference annotations are not something that would be applied to individual libraries; it would be a decision that we need to apply to all of our current generation packages.

  • For most of our libraries, the service definitions do not adequately document which fields may be null. We continue to work with our service partners to improve these definitions, but it's a large effort that we expect to continue for some time.

  • Tooling still doesn't provide a thorough understanding of what breaking changes would be introduced by enabling nullable reference annotations. Avoiding breaking changes is one of the most important core tenants of the current Azure SDK generation; until we have confidence that we can prove that nullable reference annotations are safe for the public APIs that they were added to, the risk outweighs the reward.

Additional rationale and discussion can be found in #8880.

@jsquire jsquire added issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. and removed needs-team-triage Workflow: This issue needs the team to triage. labels Feb 26, 2024
Copy link

Hi @vanillajonathan. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

@vanillajonathan
Copy link
Author

/unresolve That issue is several years old. Now is new times so it ought to be reconsidered.

This caused a bug for me and having the library annotated for nullability would improve the developer experience and reduce downstream bugs.

The Azure SDK would continue to be consistent across different libraries even with nullability since the API and behavior would remain the same. Nullability is just a compiler hint.

@github-actions github-actions bot added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. labels Feb 26, 2024
@jsquire
Copy link
Member

jsquire commented Feb 26, 2024

Adding nullability to an existing API that has been released is considered a breaking change and is not something that we would be adding in the current form. To avoid inconsistencies, we do not currently have plans to annotate new members in existing libraries. We are continuing to monitor changes in the .NET ecosystem and tooling and should a path become available to introduce annotations in a non-breaking way, we may reconsider at that point. At present, this is not something that we will be adding.

@jsquire jsquire added the issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. label Feb 26, 2024
@github-actions github-actions bot removed the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Feb 26, 2024
Copy link

Hi @vanillajonathan. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

Copy link

github-actions bot commented Mar 4, 2024

Hi @vanillajonathan, since you haven’t asked that we /unresolve the issue, we’ll close this out. If you believe further discussion is needed, please add a comment /unresolve to reopen the issue.

@github-actions github-actions bot closed this as completed Mar 4, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jun 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Bus
Projects
None yet
Development

No branches or pull requests

2 participants