locked
[UWP][C#]System.Net.Http crashed on Windows Mobile 10 - Issue exist since 2014 and no Fix from Microsoft. RRS feed

  • Question

  • If i use System.net.http the UWP crashed on Mobile Device (ARM) with out any error.
    x86/x64 works, in Debug mode also works on arm.


    Code:

    var NetWorcCredentials = new NetworkCredential("Username", "Password");
                HttpClientHandler handler = new HttpClientHandler().
                {
                    UseDefaultCredentials = true,
                    Credentials = NetWorcCredentials,
                    PreAuthenticate = true,
                };
                var GeoURL = "https://www.contoso.com/MySide/requester.aspx";
                

                System.Net.Http.HttpClient client = new System.Net.Http.HttpClient(handler);
                try
                {
                    using (System.Net.Http.HttpResponseMessage response = client.GetAsync(GeoURL, System.Net.Http.HttpCompletionOption.ResponseHeadersRead).Result)
                    {
                        response.EnsureSuccessStatusCode();
                       
                        var OutputWebRequest = response.Content.ReadAsStringAsync();
                       
                        var RequestDate = ParsingProcess.Parsing(OutputWebRequest.Result, "Date");
                    }
                    if (RequestDate == "")
                    {
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
                catch(System.Net.Http.HttpRequestException)
                {
                    return false;  
                }

    • Edited by Klaus Kroenert Wednesday, November 8, 2017 12:24 AM
    • Edited by Breeze Liu Wednesday, November 8, 2017 7:29 AM [UWP][C#]
    Wednesday, November 8, 2017 12:20 AM

All replies

  • Hi Klaus Kroenert,

    Your GeoURL can’t be accessed to, so I change it to https://www.microsoft.com to test your code in Visual Studio 2017 on the mobile device whose OS version is 1709, OS build is 15254 and it works well. Moreover my project’s target version is 16299, min version is 15063. Could you please post more information to help us reproduce your issue? Such as your device OS version, OS build and your app Target version and Min version.

    Best regards,

    Breeze


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Edited by Breeze Liu Wednesday, November 8, 2017 7:59 AM
    Wednesday, November 8, 2017 7:58 AM
  • Hi Breez,

    i am sorry:
    Visual Studio 2017 (last Update-Level), Device OS Build 15254 and Project Version is 16299 - 15063.

    I don't know, why. On a Background Task (same Project) the System.Net.Http. works.
    • Proposed as answer by Breeze Liu Thursday, November 9, 2017 3:00 AM
    Wednesday, November 8, 2017 11:08 AM
  • Hi Klaus Kroenert,

    Seems your issue has been resolved, I am also glad to hear that. Please be free to tell us if you have any issue about developing UWP apps.

    Best regards,

    Breeze


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, November 9, 2017 3:02 AM
  • Hi Breeze,

    no, this issue isn't solve.
    Yesterday evening, we had this issoe also on the Background Task.

    Thursday, November 9, 2017 2:24 PM
  • Hi Klaus Kroenert,

    There are two likely problems:

    Task.Result blocks can cause PLM to terminate the app as hung. Instead use await keywords when you use the asynchronous method.

    It doesn't catch all exceptions that HttpClient can raise. For example, if the connection times out, there will be a TaskCancelledException that isn't caught (however, the timeout is likely long enough the app would be terminated for hanging first).

    Besides, you can try to run your app in a native debugger that may show more about what is going on, especially if it is crashing rather than being killed. Moreover, field medic logs will tell if the app was terminated for hanging.

    Best regards,

    Breeze


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Edited by Breeze Liu Monday, November 13, 2017 2:58 AM
    • Proposed as answer by Breeze Liu Thursday, November 16, 2017 2:40 AM
    Monday, November 13, 2017 2:58 AM