question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Operation is not supported on this platform. when using HttpClient.send on ios and android

See original GitHub issue

Description

Why I try to call a service from ios or android I get a System.PlatformNotSupportedException. The code works perfectly in windows. even if I try to hit something like http://goole.ca I get the same error.

Steps to Reproduce

A added the following code to your default sample and get the error:

public partial class App : Application
{
	public App()
	{
		InitializeComponent();

		MainPage = new AppShell();

		try
		{
            HttpClient client = new HttpClient();
            HttpResponseMessage response = client.Send(new HttpRequestMessage(HttpMethod.Get, "http://goole.ca"));
            System.Diagnostics.Debug.WriteLine(response.StatusCode.ToString());
        }
		catch (Exception ex) 
		{
			System.Diagnostics.Debug.WriteLine(ex.Message);
		}
    }
}

I am using VS 17.4 Preview 2.1 (6.0.540) does not appear in the list below.

Link to public reproduction project repository

none

Version with bug

Unknown/Other (please specify)

Last version that worked well

Unknown/Other

Affected platforms

iOS, Android

Affected platform versions

iOS 15.5, android api33

Did you find any workaround?

No response

Relevant log output

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
JPfahlcommented, Oct 13, 2022

VS Preview 3 fixed the problem

0reactions
jfversluiscommented, Oct 7, 2022

As mentioned earlier, this is simply not supported. If you want to learn more details about the why and how you’ll have to contact the runtime team. This is not something that originates in .NET MAUI.

Read more comments on GitHub >

github_iconTop Results From Across the Web

C# - Xamarin - HttpClient - Operation is not valid due to the ...
I'm working on a cross platform library that makes HTTP requests. It's working fine on Android, but when I try to use it...
Read more >
HttpClient operations not working - Microsoft Q&A
So I have a service that is up and working, I can access it from the physical device on its browser, and make...
Read more >
Operation is not supported on this platform - Microsoft Q&A
the "Operation is not supported on this platform" error means the function was ported to .net core, but requires O/S support and was...
Read more >
Windows Authentication with HttpClient - Rick Strahl's Web Log
In this short post I review how to use HttpClient with Windows Authentication security using Negotiate or NTLM authentication schemes, ...
Read more >
Troubleshoot Smart Licensing on Catalyst Platforms
This document describes how to work with Cisco Smart Licensing (cloud-based system) to manage software licenses on Catalyst switches.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found