You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make a call to NetworkInterface.GetAllNetworkInterfaces()
Have it signed and notarized
Run the app on macOS Mojave
Expected Behavior
Method should return an array of network interfaces including (but not limited to) a loopback interface
Actual Behavior
The method returns an empty array when executing the notarized app on Mojave but correctly returns an array of network interfaces when running through the debugger on any OS or when running the notarized app on Catalina or Big Sur. Adding additional network entitlements (such as com.apple.security.network.client or com.apple.security.network.server) has no effect.
I can reproduce this behavior, but I'm not sure we can do much about it, since it sounds like a bug in Mojave. In any case I'll move this to the mono repository, which is where the corresponding networking code resides.
I encountered this while going down the Notarization rabbit hole recently.
After testing various runtime exceptions in my Entitlements.plist I discovered that the entitlement "Allow DYLD Environment Variables" (com.apple.security.cs.allow-dyld-environment-variables) is required for the GetAllNetworkInterfaces method.
If you look deep within a stacktrace of the return of NetworkInterface.GetAllNetworkInterfaces() you will see something along the lines of:
System.TypeInitializationException: The type initializer for 'System.Net.NetworkInformation.SystemNetworkInterface' threw an exception. ---> System.DllNotFoundException: libc.dylib assembly: type: member:(null)
Hope this helps, perhaps the "fix" from mono's side could be to ensure an exception is thrown all the way up when something this deep fails?
From @guygodin on Sat, 12 Sep 2020 21:47:02 GMT
Steps to Reproduce
Expected Behavior
Method should return an array of network interfaces including (but not limited to) a loopback interface
Actual Behavior
The method returns an empty array when executing the notarized app on Mojave but correctly returns an array of network interfaces when running through the debugger on any OS or when running the notarized app on Catalina or Big Sur. Adding additional network entitlements (such as com.apple.security.network.client or com.apple.security.network.server) has no effect.
Environment
Copied from original issue xamarin/xamarin-macios#9625
The text was updated successfully, but these errors were encountered: