diff --git a/src/Foundation/NSUrlSessionHandler.cs b/src/Foundation/NSUrlSessionHandler.cs index b559c2f8fabb..20bb46b6f5c9 100644 --- a/src/Foundation/NSUrlSessionHandler.cs +++ b/src/Foundation/NSUrlSessionHandler.cs @@ -459,8 +459,6 @@ protected override async Task SendAsync (HttpRequestMessage return await tcs.Task.ConfigureAwait (false); } - // Needed since we strip during linking since we're inside a product assembly. - [Preserve (AllMembers = true)] partial class NSUrlSessionHandlerDelegate : NSUrlSessionDataDelegate { readonly NSUrlSessionHandler sessionHandler; @@ -487,6 +485,7 @@ InflightData GetInflightData (NSUrlSessionTask task) return null; } + [Preserve (Conditional = true)] public override void DidReceiveResponse (NSUrlSession session, NSUrlSessionDataTask dataTask, NSUrlResponse response, Action completionHandler) { var inflight = GetInflightData (dataTask); @@ -549,6 +548,7 @@ public override void DidReceiveResponse (NSUrlSession session, NSUrlSessionDataT completionHandler (NSUrlSessionResponseDisposition.Allow); } + [Preserve (Conditional = true)] public override void DidReceiveData (NSUrlSession session, NSUrlSessionDataTask dataTask, NSData data) { var inflight = GetInflightData (dataTask); @@ -560,6 +560,7 @@ public override void DidReceiveData (NSUrlSession session, NSUrlSessionDataTask SetResponse (inflight); } + [Preserve (Conditional = true)] public override void DidCompleteWithError (NSUrlSession session, NSUrlSessionTask task, NSError error) { var inflight = GetInflightData (task); @@ -608,16 +609,19 @@ void SetResponse (InflightData inflight) } } + [Preserve (Conditional = true)] public override void WillCacheResponse (NSUrlSession session, NSUrlSessionDataTask dataTask, NSCachedUrlResponse proposedResponse, Action completionHandler) { completionHandler (sessionHandler.DisableCaching ? null : proposedResponse); } + [Preserve (Conditional = true)] public override void WillPerformHttpRedirection (NSUrlSession session, NSUrlSessionTask task, NSHttpUrlResponse response, NSUrlRequest newRequest, Action completionHandler) { completionHandler (sessionHandler.AllowAutoRedirect ? newRequest : null); } + [Preserve (Conditional = true)] public override void DidReceiveChallenge (NSUrlSession session, NSUrlSessionTask task, NSUrlAuthenticationChallenge challenge, Action completionHandler) { var inflight = GetInflightData (task); @@ -705,8 +709,6 @@ static bool TryGetAuthenticationType (NSUrlProtectionSpace protectionSpace, out } } - // Needed since we strip during linking since we're inside a product assembly. - [Preserve (AllMembers = true)] class InflightData : IDisposable { public readonly object Lock = new object (); @@ -745,8 +747,6 @@ protected virtual void Dispose (bool disposing) } - // Needed since we strip during linking since we're inside a product assembly. - [Preserve (AllMembers = true)] class NSUrlSessionDataTaskStreamContent : MonoStreamContent { Action disposed; @@ -857,8 +857,6 @@ protected internal override bool TryComputeLength (out long length) } } - // Needed since we strip during linking since we're inside a product assembly. - [Preserve (AllMembers = true)] class NSUrlSessionDataTaskStream : Stream { readonly Queue data; @@ -1004,8 +1002,6 @@ public override void Write (byte [] buffer, int offset, int count) } } - // Needed since we strip during linking since we're inside a product assembly. - [Preserve (AllMembers = true)] class WrappedNSInputStream : NSInputStream { NSStreamStatus status; diff --git a/src/ObjCRuntime/RuntimeOptions.cs b/src/ObjCRuntime/RuntimeOptions.cs index 0be4980ca743..bbcbaecb8d57 100644 --- a/src/ObjCRuntime/RuntimeOptions.cs +++ b/src/ObjCRuntime/RuntimeOptions.cs @@ -150,7 +150,6 @@ internal static RuntimeOptions Read () } } - [Preserve] // always present but re-written by the linker internal static HttpMessageHandler GetHttpMessageHandler () { var options = RuntimeOptions.Read (); diff --git a/tools/linker/MarkNSObjects.cs b/tools/linker/MarkNSObjects.cs index eca84e849ff2..af4c10942f2f 100644 --- a/tools/linker/MarkNSObjects.cs +++ b/tools/linker/MarkNSObjects.cs @@ -29,7 +29,6 @@ // using System; -using System.Collections.Generic; using Mono.Cecil; using Mono.Linker; @@ -154,8 +153,7 @@ static bool IsProductMethod (MethodDefinition method) static bool IsProductType (TypeDefinition type) { - var name = type.Module.Assembly.Name.Name; - return name == ProductAssembly || name == "System.Net.Http"; + return type.Module.Assembly.Name.Name == ProductAssembly; } } }