Fix for bug 9250 (critical bug for embedded mono) #600
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
System.Net.Sockets/Socket_2_1 had a bug introduced in 3.0.3+. The static constructor determines whether the socket / system can support ipv6. In the process uses ConfigurationManager to check application properties related to network settings.
ConfiguratationManager will always produce a ConfigurationErrorsException exception when used in the context of an application embedding mono, as there is no application configuration in this context.
This bug has preventing me from being able to upgrade from 3.0.2 for 3 months, so appreciate if can be integrated soon.
The solution is then to guard against this exception in the configuration tests and fall through to the alternative test for ipv6 functionality. The change is just try / catch + comments, nothing more.
I did not add a unit test for this as there is no way to demonstrate the problem through a C# unit test, short of creating an embedded application that attempts to create a Socket or use one of the network related facilities.
Needless to say the change does not affect the normal behavior of Socket initialization in the context of a mono exe AND also provides correct behavior for embedded applications.