Skip to content

Conversation

@monojenkins
Copy link
Collaborator

Basic application (size) for doing an HttpClient.GetAsync, release/llvm, 64bits only

The size increase occurs because of the reference to .net X509* types.
This brings a lot of additional code, including managed cryptographic
code, inside the application - even when the feature is not used.

The solution is to expose an API that only use native (OS) types, which
are mostly already part of the application. This has a very low impact
on existing applications.

It's still possible to hook back to .NET validation if needed (it should
not in most cases) but, in this case, the extra price will only be
paid if used (and can be lower if the code is needed by something else
from the application).

In comparison using other HttpClient handler produce app sizes of

  • HttpClientHandler (managed): 10.4 MB
  • CFNetworkHandler: 6.8 MB

Based on/supersede #5733
Fix #4170

Backport of #6103.

/cc @spouliot

Sebastien Pouliot and others added 3 commits May 23, 2019 12:09
…andler. Fix dotnet#4170

Basic application (size) for doing an `HttpClient.GetAsync`, release/llvm, 64bits only

- NSUrlSessionHandler (master): 6.4 MB
- NSUrlSessionHandler (PR#5936): 7.7 MB
- NSUrlSessionHandler (this PR): 6.4 MB

The size increase occurs because of the reference to .net `X509*` types.
This brings a lot of additional code, including managed cryptographic
code, inside the application - even when the feature is **not** used.

The solution is to expose an API that only use native (OS) types, which
are mostly already part of the application. This has a very low impact
on existing applications.

It's still possible to hook back to .NET validation if needed (it should
not in most cases) but, in this case, the extra price will only be
_paid_ if used (and can be lower if the code is needed by something else
from the application).

In comparison using other `HttpClient` handler produce app sizes of

- HttpClientHandler (managed): 10.4 MB
- CFNetworkHandler: 6.8 MB

Based on/supersede dotnet#5733
Fix dotnet#4170
@monojenkins monojenkins added this to the d16-2 milestone May 23, 2019
@spouliot spouliot added the requires-approval-before-merge The pull request requires special approval before it can be merged label May 23, 2019
@monojenkins
Copy link
Collaborator Author

Build success
Build succeeded
API Diff (from stable)
ℹ️ API Diff (from PR only) (please review changes)
Generator Diff (no change)
Test run succeeded

@spouliot spouliot merged commit f08d4e3 into dotnet:d16-2 May 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

requires-approval-before-merge The pull request requires special approval before it can be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants