Bug 42763 - Updating the App.config file after referencing service model section causes that section to be deleted.
Summary: Updating the App.config file after referencing service model section causes t...
Status: CONFIRMED
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies (show other bugs)
Version: 4.6.0 (C8)
Hardware: PC All
: Normal normal
Target Milestone: Future Release
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-07-22 19:37 UTC by Chris Capon
Modified: 2017-09-06 16:55 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Sample project solution which demonstrates the problem. (4.42 KB, application/zip)
2016-07-22 19:37 UTC, Chris Capon
Details

Description Chris Capon 2016-07-22 19:37:53 UTC
Created attachment 16766 [details]
Sample project solution which demonstrates the problem.

Mono version 4.2.1 (Debian 4.2.1.102+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.

Thanks,
Chris.
Comment 1 Rodrigo Kumpera 2016-07-23 00:36:13 UTC
I can reproduce with the provided test case on OSX 4.6.0.

Note You need to log in before you can comment on or make changes to this bug.