Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report for Bug 42763 on
GitHub or Developer Community if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
Created attachment 16766 [details]
Sample project solution which demonstrates the problem.
Mono version 4.2.1 (Debian 188.8.131.52+dfsg2-8)
When modifying the App.config file from within an application, if the ServiceModel Client section is referenced in the code, that section will be excluded from the updated config file.
Attached is a project which demonstrates the problem. Execute the "compile-project" shell script under Linux to reproduce the problem.
1) The App.config file contains a section for <system.serviceModel><client>.
2) When the code executes, ConfigurationManager.OpenExeConfiguration is use to retrieve the config file.
3) A key is added to the <appSettings> section.
4) Calling Configuration.Save() updates the App.config file.
The above steps work properly under both .NET and Mono.
However, if the ServiceModelSectionGroup.ClientSection is referenced within the code, under Mono, the <system.serviceModel><client> section will be removed from the updated App.config file.
This does not happen with .NET.
Within the Program.cs file, a "#if true" can be toggled to demonstrate the problem. See how the resulting application config file changes when it flips from true to false.
I can reproduce with the provided test case on OSX 4.6.0.