Warning: Could not post to webapi: Network state is disabled. Can not ping webapi

Hi All,


I want to integrate Xamarin Insights in my application and just started with the test app. I am getting Could not post to webapi: Network state is disabled. Can not ping webapi warning even though I have stable internet connectivity available on my Mac. No logs are being reported at Insights Dashboard. Following code demonstrates a simple DivideByZero exception which I am trying to register using Insights :

                   try
        {
            int divByZero = 42 / int.Parse("0");
        }
        catch (DivideByZeroException ex)
        {
            Insights.Report();
        }



Any help or pointer will be highly appreciated. Thanks a ton in advance!

-Prerana

Tagged:

Answers

  • ConorCurranConorCurran GBXamarin Team Xamurai

    Hi Perana,

    Are you sure the wifi is enabled on your emulator ?

    best,
    Conor

  • GordAllottGordAllott GBXamarin Team Xamurai

    You should try doing curl --head https://xaapi.xamarin.com/api/ping | grep X-Pong in a terminal, if you don't get output similar to X-Pong: 1452008956 (the numbers will be different) then it is likely you do not have a valid connection to xamarin servers

  • PreranaPPreranaP USUniversity

    @ConorCurran and @GordAllott thanks for the responses, yes the wifi is enabled on the simulator. The issue was in the LAN connection connected to the Mac, it has set of restrictions enabled which was blocking the xamarin servers. Switching to Wifi connection with no restrictions set resolved the issue.

    @GordAllott I will definitely keep this command in mind to check the connectivity henceforth in case of the similar error.

    Thanks again, Happy coding! :smile:

  • joehannajoehanna AUBeta ✭✭

    I am getting this on a device in Release mode with full 4G reception

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    [Xamarin.Insights] Warning: Could not post to webapi: Network state is disabled. Can not ping webapi

    I have this on an Android Device connected via Wifi to an internal network... what can I do?

  • batmacibatmaci DEMember ✭✭✭✭

    any solution for this`?

Sign In or Register to comment.