Fetching WiFi adapters list in Windows 10 app fail

2019-06-22 08:46发布

问题:

I have a Windows 10 universal app and I am trying to get the list of WiFi adapters:

var adapters = await WiFiAdapter.FindAllAdaptersAsync();

I have all the required permissions set up. This calls works once. Then when I close or kill the app, the call fails with

An attempt was made to establish a session to a network server, but there are already too many sessions established to that server. (Exception from HRESULT: 0x800704C4)

The error message is strange, I do not know how to interpret or more importantly fix it.