-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Update RefreshSignInAsync documentation and remove unnecessary null-conditional operators #64278
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
base: main
Are you sure you want to change the base?
Conversation
|
Greetings human! You've submitted a PR that modifies code that is shared with https://github.com/dotnet/runtime . Please make sure you synchronize this code with the changes in that repo! |
- Updated XML documentation to clearly state user must be signed in - Added explicit null check for auth result at the beginning - Removed unnecessary null-conditional operators after auth.Succeeded check - All existing tests pass Co-authored-by: halter73 <[email protected]>
AuthenticateAsync guarantees to return non-null result, so the explicit null check is not needed. The code now only removes unnecessary null- conditional operators after confirming auth.Succeeded is true. Co-authored-by: halter73 <[email protected]>
Update method reference to include nullable parameter annotation (string?) Co-authored-by: halter73 <[email protected]>
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.
Pull Request Overview
This PR improves the RefreshSignInAsync method documentation and removes unnecessary null-conditional operators that are redundant after null-safety checks.
Key changes:
- Added
<remarks>section to clarify thatRefreshSignInAsyncrequires the user to already be signed in with matching user ID - Removed unnecessary null-conditional operators (
?.) onauth.Principalandauth.Propertiesafterauth.Succeededvalidation, leveraging the[MemberNotNullWhen(true)]attribute guarantees
Comments suppressed due to low confidence (1)
src/Identity/Core/src/SignInManager.cs:196
- The null-conditional operator
?.onauth.Principalis unnecessary here. When!auth.Succeededis false (meaningauth.Succeededis true), the[MemberNotNullWhen(true)]attribute guarantees thatauth.Principalis non-null. Consider changing toauth.Principal.Identity?.IsAuthenticated != truefor consistency with the other changes in this PR.
if (!auth.Succeeded || auth.Principal?.Identity?.IsAuthenticated != true)
Update RefreshSignInAsync documentation and remove unnecessary null-conditional operators
Clarify
RefreshSignInAsyncrequirements and fix inconsistent null checksDescription
The
RefreshSignInAsyncdocumentation did not state that users must already be signed in. The method also used inconsistent null-conditional operators—checkingauth.Succeededdirectly but then usingauth?.PropertiesdespiteAuthenticateResult.Succeededguaranteeing non-null properties.Changes:
<remarks>to documentation clarifying user must be signed in and user ID must match?.operators onauth.Principalandauth.Propertiesafterauth.Succeededvalidation (lines 211, 212, 228)?.operators in failure branches where properties may be nullFixes #{issue number}
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
cdn.jsdelivr.net/home/REDACTED/work/aspnetcore/aspnetcore/.dotnet/dotnet exec --depsfile /home/REDACTED/work/aspnetcore/aspnetcore/artifacts/bin/Microsoft.AspNetCore.Identity.Test/Debug/net10.0/Microsoft.AspNetCore.Identity.Test.deps.json --runtimeconfig /home/REDACTED/work/aspnetcore/aspnetcore/artifacts/bin/Microsoft.AspNetCore.Identity.Test/Debug/net10.0/Microsoft.AspNetCore.Identity.Test.runtimeconfig.json /home/REDACTED/.nuget/packages/xunit.REDACTED.console/2.9.2/tools/netcoreapp2.0/xunit.console.dll /home/REDACTED/work/aspnetcore/aspnetcore/artifacts/bin/Microsoft.AspNetCore.Identity.Test/Debug/net10.0/Microsoft.AspNetCore.Identity.Test.dll -noautoreporters -xml /home/REDACTED/work/aspnetcore/aspnetcore/artifacts/TestResults/Debug/Microsoft.AspNetCore.Identity.Test_net10.0_x64.xml -html /home/REDACTED/work/aspnetcore/aspnetcore/artifacts/TestResults/Debug/Microsoft.AspNetCore.Identity.Test_net10.0_x64.html -notrait Quarantined=true -nocolor(dns block)cdnjs.cloudflare.com/home/REDACTED/work/aspnetcore/aspnetcore/.dotnet/dotnet exec --depsfile /home/REDACTED/work/aspnetcore/aspnetcore/artifacts/bin/Microsoft.AspNetCore.Identity.Test/Debug/net10.0/Microsoft.AspNetCore.Identity.Test.deps.json --runtimeconfig /home/REDACTED/work/aspnetcore/aspnetcore/artifacts/bin/Microsoft.AspNetCore.Identity.Test/Debug/net10.0/Microsoft.AspNetCore.Identity.Test.runtimeconfig.json /home/REDACTED/.nuget/packages/xunit.REDACTED.console/2.9.2/tools/netcoreapp2.0/xunit.console.dll /home/REDACTED/work/aspnetcore/aspnetcore/artifacts/bin/Microsoft.AspNetCore.Identity.Test/Debug/net10.0/Microsoft.AspNetCore.Identity.Test.dll -noautoreporters -xml /home/REDACTED/work/aspnetcore/aspnetcore/artifacts/TestResults/Debug/Microsoft.AspNetCore.Identity.Test_net10.0_x64.xml -html /home/REDACTED/work/aspnetcore/aspnetcore/artifacts/TestResults/Debug/Microsoft.AspNetCore.Identity.Test_net10.0_x64.html -notrait Quarantined=true -nocolor(dns block)stackpath.bootstrapcdn.com/home/REDACTED/work/aspnetcore/aspnetcore/.dotnet/dotnet exec --depsfile /home/REDACTED/work/aspnetcore/aspnetcore/artifacts/bin/Microsoft.AspNetCore.Identity.Test/Debug/net10.0/Microsoft.AspNetCore.Identity.Test.deps.json --runtimeconfig /home/REDACTED/work/aspnetcore/aspnetcore/artifacts/bin/Microsoft.AspNetCore.Identity.Test/Debug/net10.0/Microsoft.AspNetCore.Identity.Test.runtimeconfig.json /home/REDACTED/.nuget/packages/xunit.REDACTED.console/2.9.2/tools/netcoreapp2.0/xunit.console.dll /home/REDACTED/work/aspnetcore/aspnetcore/artifacts/bin/Microsoft.AspNetCore.Identity.Test/Debug/net10.0/Microsoft.AspNetCore.Identity.Test.dll -noautoreporters -xml /home/REDACTED/work/aspnetcore/aspnetcore/artifacts/TestResults/Debug/Microsoft.AspNetCore.Identity.Test_net10.0_x64.xml -html /home/REDACTED/work/aspnetcore/aspnetcore/artifacts/TestResults/Debug/Microsoft.AspNetCore.Identity.Test_net10.0_x64.html -notrait Quarantined=true -nocolor(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.