-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Cross-compile SignalR client libraries and enable platform compat ana… #26140
Conversation
src/SignalR/clients/csharp/Http.Connections.Client/src/HttpConnection.cs
Outdated
Show resolved
Hide resolved
src/SignalR/clients/csharp/Http.Connections.Client/src/HttpConnection.cs
Show resolved
Hide resolved
src/SignalR/clients/csharp/Http.Connections.Client/src/HttpConnection.cs
Outdated
Show resolved
Hide resolved
df9b38e
to
1438f75
Compare
1438f75
to
876befa
Compare
// Set this header so the server auth middleware will set an Unauthorized instead of Redirect status code | ||
// See: https://github.com/aspnet/Security/blob/ff9f145a8e89c9756ea12ff10c6d47f2f7eb345f/src/Microsoft.AspNetCore.Authentication.Cookies/Events/CookieAuthenticationEvents.cs#L42 | ||
#pragma warning disable CA1416 // Analyzer bug |
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.
Is there an issue related to the analyzer bug that we can link to?
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.
No, I was hoping this was the result of one of the SDK bugs that was already resolved.
@mavasani \ @buyaa-n any idea why this might be busted and how we could track this? I can't get a minimal app that reproduces the problem, but it is consistent in this branch of AspNetCore. I "updated" this branch to target 5.0.100-rc.2.20472.12
but that doesn't appear to help.
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.
5.0.100-rc.2.20472.12
I am presuming this is the SDK version? Can you try the latest RC2 NuGet package: https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet5&package=Microsoft.CodeAnalysis.NetAnalyzers&protocolType=NuGet&version=5.0.0-rc2.20471.13&view=overview?
Can you also check if this repros if you replace the boolean check above with explicit OperatingSystem.IsBrowser()
check? If that removes the false positive, then it is likely that something in flow analysis is causing the state stored in the bool to get lost before this if block. I can try to repro this later today.
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.
Surprsingly seems it is worked above on row 45 and 64, somehow working on off?
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.
No good. As @buyaa-n pointed out, the same check works in the ifs above, just not after the if block on line 52
Do we need to update Protocols.MessagePack and Protocols.NewtonsoftJson to also target DefaultNetCoreTargetFramework? |
src/SignalR/clients/csharp/Http.Connections.Client/src/HttpConnectionFactory.cs
Show resolved
Hide resolved
src/SignalR/clients/csharp/Http.Connections.Client/src/Internal/LongPollingTransport.cs
Show resolved
Hide resolved
src/SignalR/clients/csharp/Http.Connections.Client/src/Internal/WebSocketsTransport.cs
Outdated
Show resolved
Hide resolved
src/SignalR/clients/csharp/Http.Connections.Client/src/Internal/WebSocketsTransport.cs
Outdated
Show resolved
Hide resolved
src/SignalR/clients/csharp/Http.Connections.Client/src/HttpConnectionFactory.cs
Show resolved
Hide resolved
876befa
to
998cc42
Compare
{ | ||
var accessTokenEncoded = UrlEncoder.Default.Encode(accessToken); | ||
accessTokenEncoded = "access_token=" + accessTokenEncoded; | ||
resolvedUrl = Utils.AppendQueryString(resolvedUrl, accessTokenEncoded); | ||
} | ||
else | ||
{ | ||
#pragma warning disable CA1416 // Analyzer bug |
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.
This feels surprising given you have an explicit OperatingSystem.IsBrowser()
check in the if part. What are the platform attributes applied to Options
and SetRequestHeader
symbols?
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.
Seems [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
https://github.com/dotnet/runtime/pull/41963/files#diff-0f06b592b2ee5b30d95ae38efae16a85R49
Can we add supported platform browser to https://github.com/dotnet/aspnetcore/blob/master/src/SignalR/common/Protocols.Json/src/Microsoft.AspNetCore.SignalR.Protocols.Json.csproj? |
44739f9
to
f715aa5
Compare
...R/common/Protocols.MessagePack/src/Microsoft.AspNetCore.SignalR.Protocols.MessagePack.csproj
Show resolved
Hide resolved
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.
Next up add nullability to these types
src/SignalR/clients/csharp/Http.Connections.Client/src/HttpConnectionFactory.cs
Show resolved
Hide resolved
Hello @pranavkm! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
…lyzer
Contributes to #25917