-
Notifications
You must be signed in to change notification settings - Fork 10k
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
CreatedResult should accept null location #42576
Conversation
Thanks for your PR, @singh733. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @singh733! I'll try to get back to you soon with the API decision.
@@ -64,19 +60,10 @@ public CreatedResult(Uri location, object? value) | |||
/// <summary> | |||
/// Gets or sets the location at which the content has been created. | |||
/// </summary> | |||
public string Location |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When approving the API in #39454 (comment), we did not consider that this property would need to be made nullable. I'll update the API proposal and see if everyone still thinks we should change MVC's CreatedResult
or if it's too breaking.
We can work out the PublicAPI.Unshipped.txt
changes to get the build to pass. It gets complicated when changing the nullability of shipped APIs. We might have to bypass the build check when changing the nullablity of a property setter like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To fix this you need to update the shipped.txt file for nullability changes instead of the unshipped.txt file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BrennanConroy When we update the shipped.txt file we got the following error in build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's expected, someone will be able to override that and merge the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're good once you delete TypedResults.Created(string uri)
and TypedResults.Created(Uri uri)
. We can deal with the PublicAPI.Unshipped.txt
changes like I mentioned earlier.
One more thing. There were also a bunch of |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Triage: Need to follow-up on the PublicAPI.txt issues that are blocking this. Let's see about merging with override if there are no other issues in this PR. |
@captainsafia Do you need any change from my side ? |
@singh733 Thanks for offering to continue updating this after all this time! I appreciate you sticking with it. I think I managed to massage the PublicAPI.Unshipped.txt files to get the build passing. I thought we were going to have to resort to changing a PublicAPI.Shipped.txt to get the nullability change to the Location property through, but it seems it's alright with claiming the setter is unchanged. Sometimes the analyzer doesn't capture enough information to notice API changes. See dotnet/roslyn-analyzers#3047 and dotnet/roslyn-analyzers#3901. While I was at it, I rebased your changes on Because this didn't make it for .NET 7, I removed the changes that removed I also reverted the change that caused |
Thanks again @singh733! |
Task #39454
CreatedResult should accept null location
Description
The primary resource created by the request is identified by either a Location header field in the response or, if no Location field is received, by the effective request URI.