NetworkInformationException when adding listener to NetworkAvailabilityChanged event
We recently started seeing this exception pop up during initialization:
System.Net.NetworkInformation.NetworkInformationException: An operation was attempted on something that is not a socket
at System.Net.NetworkInformation.NetworkChange.AddressChangeListener.StartHelper(NetworkAddressChangedEventHandler caller, Boolean captureContext, StartIPOptions startIPOptions)
at System.Net.NetworkInformation.NetworkChange.AvailabilityChangeListener.Start(NetworkAvailabilityChangedEventHandler caller)
at System.Net.NetworkInformation.NetworkChange.add_NetworkAvailabilityChanged(NetworkAvailabilityChangedEventHandler value)
(snip)
This is an app that runs on a number of client machines. This subscription is one 开发者_StackOverflow社区of the first things we do during initialization, and the code around it hasn't changed recently. Since the stack trace is several layers below a subscription call (and thus not directly influenced by any parameters we send), I suspect that something has changed out from underneath us, but I haven't been able to find enough information on this exception to know where to start looking.
Any ideas would be greatly appreciated!
Ultimately this turned out to be associated with our use of the Komodia Redirector (our install process was not happening cleanly which can lead to some strange behavior at the network LSP layer). Once we got the install to work properly, this issue went away (though we later ditched Komodia for unrelated reasons).
精彩评论