Forum Visual Studio

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

This instance has already started one or more requests.

Actual Exception : This instance has already started one or more requests. Properties can only be modified before sending the first request
I'm facing this exception when I build and run my app using Visual studios 2019.
service call in Xamarin Android are not happening and throwing this exception. But the same code is working fine in Visual studios 2017

Can any one please help me on this ?

Best Answer

Answers

  • EswaraprabuEswaraprabu Member ✭✭
    edited June 2020

    Hi RajaRanganathan,

    In my scenario i have initialised my HTTPClient as singleton

    public HttpClient Client
    {
    get
    {
    if (_client == null)
    {
    _client = new HttpClient();
    }
    return _client;
    }
    set
    {
    _client = value;
    }
    }

    at the beginning of each service call the Client has be called. When I was facing this issue I initialised as Client = new HttpClient(); at the beginning of the method it resolved the issue.

Sign In or Register to comment.