Skip to content

Bug: The Status property of WiFiDirectAdvertisementPublisher is not updated after the Publisher is initially started #1987

Open
@TomWilloughby

Description

@TomWilloughby

Description

The c# WiFiDirectAdvertisementPublisher class doesn't update its status after it's network is Started.

What works: the WiFi Direct Legacy network will not start and Publisher.Status will be Aborted if the publisher is started with WiFi switched off through the Modern UI Settings (e.g. via the taskbar or via ms-settings:network-wifi).

What doesn't work: when the publisher is started with WiFi swiched on the network starts as expected, but switching the WiFi off while it's in the Started state will seemingly shut down the network and disconnect any connected devices without changing the Publisher.Status or invoking Publisher.StatusChanged.

I'm hoping this is the right repo to report this to.

I have a reproduction using .NET 9 that shows the above behaviour on both a Windows 11 Dell XPS 15 and a Windows 10 Lenovo Thinkpad E550.
https://github.com/TomWilloughby/WiFi-Direct-No-Status-Update/blob/main/README.md

I've also seen this issue on .NET Framework 4.8.0 on the Windows 11 Dell XPS 15.

Steps To Reproduce

  1. Create an instance of the WiFiDirectAdvertisementPublisher class.
  2. Set Publisher.Advertisement.IsAutonomousGroupOwnerEnabled = True, Publisher.Advertisement.LegacySettings.IsEnabled = true, Publisher.Advertisement.LegacySettings.Ssid = "HelloWorld", Publisher.Advertisement.LegacySettings.Passphrase.Password = "Pa$$w0rd".
  3. Hook up Publisher.StatusChanged to log the new statuses.
  4. Call Publisher.Start().
  5. Run the code.
  6. Notice that the network has started successfully.
  7. Connect another device to the network.
  8. Turn off WiFi using the toggle switch in the ms-settings:network-wifi screen.
  9. Notice that the connected device disconnects, but the WiFi network status does not update.
  10. Close the app, and start it again with WiFi already switched off.
  11. Notice that the network does not start successfully, and the status is Aborted

Expected Behavior

If the WiFi is switched off after the Publisher is Started, the Publisher status should change to Aborted. This would be consistent with what happens when the WiFi is already switched off while the Publisher is being Started.

I'm not sure what the expected behaviour is for when the WiFi network is off and then switched back on - at the moment I'm just checking if the Publisher status is Started every 30 seconds and, if not, I stop and restart the Publisher.

Version Info

.NET 9 on Windows 11 v10.0.26100 and Windows 10 v10.0.18363 and .NET Framework v4.8.0 Windows 11 v10.0.26100

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions