wifi scan exception can not be fixed except reboot device RRS feed

  • Question

  •       private async Task<bool> _InitializeAdapterAsync()

    { DoCoMoSystem.WriteLog("initialize wifi adapter."); var access = await WiFiAdapter.RequestAccessAsync(); if (access != WiFiAccessStatus.Allowed) { DoCoMoSystem.WriteLog("Wifi access denied!"); return false; } var result = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(WiFiAdapter.GetDeviceSelector()); if (result.Count >= 1) { _firstAdapter = await WiFiAdapter.FromIdAsync(result[0].Id); return true; } else { DoCoMoSystem.WriteLog("no wifi adapter!"); return false; } }

            private async Task _WifiScanAsync()
                if (_firstAdapter == null) return;
                    _firstAdapter.AvailableNetworksChanged += _firstAdapter_AvailableNetworksChanged;
                    await _firstAdapter.ScanAsync();
                catch (Exception ex)
                    DoCoMoSystem.WriteLog("wifi scan exception..." + ex);

    above code is my wifi scan key code, in my app(running on a win10 tablet device), if I idle the device with no wifi connected for nearly 1 or 2 hrs, then go to the wifi scan page, it'll throw scan exception:

    System.Exception: Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
    at DCMModule.DCMWiFi.<_WifiScanAsync>d__14.MoveNext()'

    the exception seems can not be avoided  except I reboot my device. and I don't know why and how to fix it.

    does somebody give me better advice than rebooting device operation? 

    Wednesday, April 12, 2017 2:56 AM

All replies

  • Hi Ivan JL Zhang,

    Welcome to the Developing Universal Windows apps forum!

    Please read the sticky posts, especially the Guide to posting: subject line tags and Known Issues for Windows 10 SDK and Tools  and please remember to add tag to title.

    Have you added some break points to debug your code to see which line occurs this exception in visual studio? And since you said this issue occurred when no WiFi connected for nearly 1or 2 hours, you’d better share your entire repro code sample and detailed steps with us, I would help you diagnose this issue quickly. You could upload it to OneDrive and post link here.

    Anyway, before you share your code sample here. I will first test the official Wi-Fi scanning sample in my side to see if I can reproduce this issue.

    [Updated on 4/14/2017]

    I've tested the official code sample, but I cannot reproduce it.

    Best Regards,

    Xavier Eoro

    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

    • Edited by Xavier Xie-MSFTModerator Friday, April 14, 2017 2:51 AM updated
    • Proposed as answer by kex324423 Monday, September 10, 2018 11:34 PM
    • Unproposed as answer by kex324423 Monday, September 10, 2018 11:34 PM
    Thursday, April 13, 2017 9:00 AM
  • I have a similar problem. In my case ScanAsync method fails after connect method.

    Steps to reproduce error with official Wi-Fi scanning sample:

    Initial steps:

    1. Go to scenario "4) Connect"
    2. Click Scan button
    3. If any network is connected then click Disconnect button

    The next two steps cause an error:

    1. Click Connect button 
    2. Wait for the success notification and click Scan button

    ScanAsync method (Scenario4_Connect.xaml.cs, Line 130) fails after Connect method.

    Error message:
    "Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))"

    Stack trace:

       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
       at WiFiScan.Scenario4_Connect.<ScanButton_Click>d__12.MoveNext()

    • Edited by kex324423 Monday, September 10, 2018 11:32 PM
    Monday, September 10, 2018 11:30 PM