Skip to content

.NET MAUI iOS "Operation not supported on this platform" #1918

@vladsava87

Description

@vladsava87

Describe the bug
In a .NET MAUI project running on iOS, creating an new instance of RestClient, throws an "Operation not supported on this platform" exception.
Android works as expected.

To Reproduce
Create new .NET MAUI project, add RestSharp nuget and create new RestClient object.
Run project on iOS configuration.

Expected behavior
Create a new instance of RestClient

Stack trace
at System.Net.Http.NSUrlSessionHandler.set_Proxy(IWebProxy value)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
--- End of stack trace from previous location ---
at System.Net.Http.HttpClientHandler.InvokeNativeHandlerMethod(String name, Object[] parameters)
at System.Net.Http.HttpClientHandler.SetProxy(IWebProxy value)
at System.Net.Http.HttpClientHandler.set_Proxy(IWebProxy value)
at RestSharp.RestClient.ConfigureHttpMessageHandler(HttpClientHandler handler)
at RestSharp.RestClient..ctor(RestClientOptions options, Action`1 configureDefaultHeaders)
at RestSharp.RestClient..ctor()
at MauiAuth0App.MauiProgram.CreateMauiApp() in /Users/vladsteer73/Work/R&D/dotnet-maui-auth0-app-main/MauiProgram.cs:line 32

Desktop (please complete the following information):

  • OS: macOS
  • .NET 6
  • Version 6.0.400

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions