Certain VPNs cause MAUI to respond with connectivity of NetworkAccess.Local
Description
When building a Windows MAUI app, the NetworkAccess will sometimes return Local for laptop connected via Wifi with Tailscale installed and the Tailscale interface shows up before the wifi Interface in the Control Panel Network Connections screen. I think that the logic may be picking the first connection when you may have more than one connection which is unexpected as Windows itself reports you have internet access but the app thinks you don't.
Steps to Reproduce
It might take a bit of trial and error to reproduce. I was able to disable Tailscale which then returned NetworkAccess.Internet to the app. Now the Tailscale interface is 4th in the list.
Link to public reproduction project repository
No response
Version with bug
8.0.7 SR2
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
Windows SDK
Did you find any workaround?
Disabling the VPN interface helps.
Relevant log output
?Windows.Networking.Connectivity.NetworkInformation.GetInternetConnectionProfile()
{Windows.Networking.Connectivity.ConnectionProfile}
CanDelete: false
IsWlanConnectionProfile: false
IsWwanConnectionProfile: false
NetworkAdapter: {Windows.Networking.Connectivity.NetworkAdapter}
NetworkSecuritySettings: {Windows.Networking.Connectivity.NetworkSecuritySettings}
ProfileName: "Tailscale"
ServiceProviderGuid: null
WlanConnectionProfileDetails: null
WwanConnectionProfileDetails: null
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Closed similar issues:
- Maui Connectivity Change from Online to Offline to Online Connectivity.NetworkAccess == Unknown on Windows 10 (#15803), similarity score: 0.77
- Windows: Connectivity check sometimes return NetworkAccess.Unknown (#17270), similarity score: 0.72
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
Verified this issue with Visual Studio 17.10 Preview 7.0 (8.0.21). Can repro it.
I just try to reproduce the issue with another repro https://github.com/breenbob/MauiWindowsConnectivityIssue, and I got the below result:
- When a VPN is connected, the value is NetworkAccess.Local
- When the VPN is not connected, the value is NetworkAccess.Internet
If you have other comments, please provide your repro demo App, I could re-verify.
https://github.com/dotnet/maui/blob/ea5ca41a763b3177eb5e686a555fef1958198f14/src/Essentials/src/Connectivity/Connectivity.uwp.cs#L20-L73
This codeblock was changed recently so https://github.com/dotnet/maui/pull/22013 could fix your issue, since it should call the correct path to get the network value. If you run the underlying code for profile.GetNetworkConnectivityLevel
var profile = NetworkInformation.GetInternetConnectionProfile();
if (profile == null)
return NetworkAccess.Unknown;
var level = profile.GetNetworkConnectivityLevel();
return level switch
{
NetworkConnectivityLevel.LocalAccess => NetworkAccess.Local,
NetworkConnectivityLevel.InternetAccess => NetworkAccess.Internet,
NetworkConnectivityLevel.ConstrainedInternetAccess => NetworkAccess.ConstrainedInternet,
_ => NetworkAccess.None,
};
What value do you get?
Running on windows 11 through the Immediate Window
?Windows.Networking.Connectivity.NetworkInformation.GetInternetConnectionProfile().GetNetworkConnectivityLevel()
InternetAccess
?Connectivity.Current.NetworkAccess
Local
The Windows.Networking.Connectivity.NetworkInformation.GetInternetConnectionProfile() gets the correct value and my Windows 11 machine passes the new IsWindowsVersionAtLeast check. It does look like this check will pass though I have no idea if a Windows 10 machine would.