[linker] Stop passing data to the CoreHttpMessageHandler step using a constructor.

This commit is contained in:
Rolf Bjarne Kvinge 2020-05-07 10:19:24 +02:00
Родитель 03c6f8d1cc
Коммит 0dde91584c
3 изменённых файлов: 5 добавлений и 12 удалений

Просмотреть файл

@ -23,13 +23,10 @@ namespace Xamarin.Linker.Steps {
public class CoreHttpMessageHandler : ExceptionalSubStep {
public CoreHttpMessageHandler (LinkerOptions options)
public CoreHttpMessageHandler ()
{
Options = options;
}
public LinkerOptions Options { get; private set; }
public override SubStepTargets Targets {
get { return SubStepTargets.Type; }
}
@ -39,11 +36,7 @@ namespace Xamarin.Linker.Steps {
Application App {
get {
#if MONOMAC
return Driver.App;
#else
return Options.Application;
#endif
return LinkContext.App;
}
}
@ -72,7 +65,7 @@ namespace Xamarin.Linker.Steps {
MethodDefinition method = type.Methods.First (x => x.Name == "GetHttpMessageHandler" && !x.HasParameters);
AssemblyDefinition systemNetHTTPAssembly = context.GetAssemblies ().First (x => x.Name.Name == "System.Net.Http");
TypeDefinition handler = RuntimeOptions.GetHttpMessageHandler (App, Options.RuntimeOptions, systemNetHTTPAssembly.MainModule, type.Module);
TypeDefinition handler = RuntimeOptions.GetHttpMessageHandler (App, LinkContext.Target.LinkerOptions.RuntimeOptions, systemNetHTTPAssembly.MainModule, type.Module);
MethodReference handler_ctor = handler.Methods.First (x => x.IsConstructor && !x.HasParameters && !x.IsStatic);
// HttpClientHandler is defined in System.Net.Http.dll so we need to import

Просмотреть файл

@ -175,7 +175,7 @@ namespace MonoMac.Tuner {
if (options.Application.Optimizations.CustomAttributesRemoval == true)
sub.Add (new CoreRemoveAttributes ());
sub.Add (new CoreHttpMessageHandler (options));
sub.Add (new CoreHttpMessageHandler ());
sub.Add (new MarkNSObjects ());
// CoreRemoveSecurity can modify non-linked assemblies

Просмотреть файл

@ -114,7 +114,7 @@ namespace MonoTouch.Tuner {
sub.Add (new RemoveCode (options));
sub.Add (new MarkNSObjects ());
sub.Add (new PreserveSoapHttpClients ());
sub.Add (new CoreHttpMessageHandler (options));
sub.Add (new CoreHttpMessageHandler ());
sub.Add (new InlinerSubStep ());
sub.Add (new PreserveSmartEnumConversionsSubStep ());
return sub;