[Trimming] Put code for resolving HttpMessageHandler type name behind feature switch #10002
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We support passing the HTTP message handler type name via the
AndroidHttpClientHandlerType
or theXA_HTTP_CLIENT_HANDLER_TYPE
environment variable. This is not compatible with trimming by default and while we can make sure this type is preserved by IL Link via custom trimmer steps, there is no reasonable way to do this for NativeAOT.I suggest disabling the handler type lookup via
XA_HTTP_CLIENT_HANDLER_TYPE
env variable by default and introducing a feature switch to re-enable this feature. TheGetHttpMessageHandler()
method would simply return an instance ofAndroidMessageHandler
by default.If this is deemed too drastic, we could only disable the feature switch for NativeAOT.
Open question and follow-up work:
AndroidHttpClientHandlerType
instead of a checkbox forUseNativeHttpHandler
?AndroidHttpClientHandlerType
somewhere, that should be skipped if the feature switch is not enabled