-
Notifications
You must be signed in to change notification settings - Fork 262
Closed
microsoftgraph/msgraph-sdk-dotnet-core
#13Labels
Description
Issue
NSUrlSessionHandler - Xamarin.iOS - handles decompression out of the box and doesn't provide an option to turn it off. This throws a System.IO.IOException: Corrupted data ReadInternal exception when our CompressionHandler is used alongside NSUrlSessionHandler as described in issue #413.
Workaround
The current work around involves creating a new pipeline without the CompressionHandler.
#if __IOS__
var innerHandler = new NSUrlSessionHandler { AllowAutoRedirect = false };
var handlers = GraphClientFactory.CreateDefaultHandlers(authProvider);
// Remove CompressionHandler from pipeline when using NSUrlSessionHandler.
handlers.Remove(handlers.FirstOrDefault((h) => h.GetType().Equals(typeof(CompressionHandler)))); // We need to provide a method to remove handlers by type.
var pipeline = GraphClientFactory.CreatePipeline(handlers , innerHandler);
httpProvider = new HttpProvider(pipeline, true, new Serializer());