[Mono-list] Passing app.config on command line to console app:not implemented

cam cambevis at gmail.com
Fri May 15 16:15:26 UTC 2015


Hello All,


I'm trying to get a console app running on mono, runs fine on Windows 7.  It
was developed in VS2012.

Env:
Centos 6.6
Mono JIT compiler version 4.1.0 (master/f4f5864 Wed May 13 12:21:17 CDT
2015)

Code that won't run:
  //get app settings file at runtime 
            System.Configuration.Configuration config =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            config.AppSettings.File = args[0];
            config.Save(ConfigurationSaveMode.Modified);
            ConfigurationManager.RefreshSection("appSettings");


Stack trace: (weird that it doesn't reference a particular line # in MY
file)
Unhandled Exception:
System.NotImplementedException: The method or operation is not implemented.
  at System.Configuration.AppSettingsSection.SerializeSection
(System.Configuration.ConfigurationElement parent, System.String name,
ConfigurationSaveMode mode) [0x0001f] in
/root/mono/mcs/class/System.Configuration/System.Configuration/AppSettingsSection.cs:104
  at System.Configuration.SectionInfo.WriteData
(System.Configuration.Configuration config, System.Xml.XmlWriter writer,
ConfigurationSaveMode mode) [0x0002e] in
/root/mono/mcs/class/System.Configuration/System.Configuration/SectionInfo.cs:196
  at System.Configuration.SectionGroupInfo.WriteContent
(System.Xml.XmlWriter writer, System.Configuration.Configuration config,
ConfigurationSaveMode mode, Boolean writeElem) [0x00059] in
/root/mono/mcs/class/System.Configuration/System.Configuration/SectionGroupInfo.cs:399
  at System.Configuration.SectionGroupInfo.WriteRootData
(System.Xml.XmlWriter writer, System.Configuration.Configuration config,
ConfigurationSaveMode mode) [0x00000] in
/root/mono/mcs/class/System.Configuration/System.Configuration/SectionGroupInfo.cs:383
  at System.Configuration.Configuration.SaveData (System.Xml.XmlTextWriter
tw, ConfigurationSaveMode mode, Boolean forceUpdateAll) [0x00000] in
/root/mono/mcs/class/System.Configuration/System.Configuration/Configuration.cs:487
  at System.Configuration.Configuration.Save (System.IO.Stream stream,
ConfigurationSaveMode mode, Boolean forceUpdateAll) [0x00117] in
/root/mono/mcs/class/System.Configuration/System.Configuration/Configuration.cs:475
  at System.Configuration.Configuration.Save (ConfigurationSaveMode mode,
Boolean forceUpdateAll) [0x00066] in
/root/mono/mcs/class/System.Configuration/System.Configuration/Configuration.cs:409
[ERROR] FATAL UNHANDLED EXCEPTION: System.NotImplementedException: The
method or operation is not implemented.
  at System.Configuration.AppSettingsSection.SerializeSection
(System.Configuration.ConfigurationElement parent, System.String name,
ConfigurationSaveMode mode) [0x0001f] in
/root/mono/mcs/class/System.Configuration/System.Configuration/AppSettingsSection.cs:104
  at System.Configuration.SectionInfo.WriteData
(System.Configuration.Configuration config, System.Xml.XmlWriter writer,
ConfigurationSaveMode mode) [0x0002e] in
/root/mono/mcs/class/System.Configuration/System.Configuration/SectionInfo.cs:196
  at System.Configuration.SectionGroupInfo.WriteContent
(System.Xml.XmlWriter writer, System.Configuration.Configuration config,
ConfigurationSaveMode mode, Boolean writeElem) [0x00059] in
/root/mono/mcs/class/System.Configuration/System.Configuration/SectionGroupInfo.cs:399
  at System.Configuration.SectionGroupInfo.WriteRootData
(System.Xml.XmlWriter writer, System.Configuration.Configuration config,
ConfigurationSaveMode mode) [0x00000] in
/root/mono/mcs/class/System.Configuration/System.Configuration/SectionGroupInfo.cs:383
  at System.Configuration.Configuration.SaveData (System.Xml.XmlTextWriter
tw, ConfigurationSaveMode mode, Boolean forceUpdateAll) [0x00000] in
/root/mono/mcs/class/System.Configuration/System.Configuration/Configuration.cs:487
  at System.Configuration.Configuration.Save (System.IO.Stream stream,
ConfigurationSaveMode mode, Boolean forceUpdateAll) [0x00117] in
/root/mono/mcs/class/System.Configuration/System.Configuration/Configuration.cs:475
  at System.Configuration.Configuration.Save (ConfigurationSaveMode mode,
Boolean forceUpdateAll) [0x00066] in
/root/mono/mcs/class/System.Configuration/System.Configuration/Configuration.cs:409

Using block:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.IO;

Any ideas folks?






--
View this message in context: http://mono.1490590.n4.nabble.com/Passing-app-config-on-command-line-to-console-app-not-implemented-tp4665942.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list