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

[net6.0-android] HttpClient.ServerCertificateCustomValidationCallback throws 'Arg_PlatformNotSupported' #57537

Closed
PureWeen opened this issue Aug 17, 2021 · 7 comments · Fixed by #58456

Comments

@PureWeen
Copy link
Member

Description

Try to set HttpClient.ServerCertificateCustomValidationCallback when running as net6.0-android

Configuration

net6.0-android
dotnet version: 6.0.100-preview.7.21379.14

Regression?

This worked inside Xamarin.Android

Other information

MauiPool.zip

@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Net.Http untriaged New issue has not been triaged by the area owner labels Aug 17, 2021
@ghost
Copy link

ghost commented Aug 17, 2021

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

Try to set HttpClient.ServerCertificateCustomValidationCallback when running as net6.0-android

Configuration

net6.0-android
dotnet version: 6.0.100-preview.7.21379.14

Regression?

This worked inside Xamarin.Android

Other information

MauiPool.zip

Author: PureWeen
Assignees: -
Labels:

area-System.Net.Http, untriaged

Milestone: -

@ghost
Copy link

ghost commented Aug 17, 2021

Tagging subscribers to 'arch-android': @steveisok, @akoeplinger
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

Try to set HttpClient.ServerCertificateCustomValidationCallback when running as net6.0-android

Configuration

net6.0-android
dotnet version: 6.0.100-preview.7.21379.14

Regression?

This worked inside Xamarin.Android

Other information

MauiPool.zip

Author: PureWeen
Assignees: -
Labels:

area-System.Net.Http, os-android, untriaged

Milestone: -

@filipnavara
Copy link
Member

See #57555 and the linked issue.

There was an intentional change to use native HTTP handlers for new HttpClientHandler() scenario (as opposed to only using it for new HttpClient() in earlier Xamarin platforms). This causes some properties to throw PNSE even if the underlying handler ended up being SocketsHttpHandler (eg. when native handler is switched off in .csproj). The above PR fixes that but there's possibly still some work remaining on the XA/XI side to implement the missing properties on the native handlers.

cc @steveisok if some further clarification is required.

@lewing lewing added this to the 6.0.0 milestone Aug 20, 2021
@lewing lewing removed the untriaged New issue has not been triaged by the area owner label Aug 20, 2021
@marek-safar
Copy link
Contributor

This has been fixed and just waiting on backport to 6.0, @steveisok right?

@steveisok
Copy link
Member

It looks like ServerCertificateCustomValidationCallback is still PNSE on the native handler only.

Do you happen to know what the right linker suppression syntax would be for Func<HttpRequestMessage, X509Certificate2?, X509Chain?, SslPolicyErrors, bool> ?

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Aug 31, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Sep 1, 2021
@karelz
Copy link
Member

karelz commented Sep 3, 2021

Reopening to track port to 6.0

@karelz karelz reopened this Sep 3, 2021
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Sep 3, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Sep 8, 2021
@karelz
Copy link
Member

karelz commented Sep 8, 2021

Fixed in 6.0 RC2 in PR #58508.
Fixed in 7.0 in PR #58456.

@ghost ghost locked as resolved and limited conversation to collaborators Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.