I have been trying to implement the Configuration Management Application Block and I am running into some trouble. If anyone has experience with this block I would appreciate a nudge in the right direction.
I am getting the following error when I attempt to write to configuration:
An unhandled exception of type 'System.Configuration.ConfigurationException' occurred in microsoft.applicationblocks.configurationmanagement.dll
Additional information: Section 'TarponCoreConfig' not defined on the configuration file. Check the /configuration/configSections/section node in the application config file (assemblyfilename.config). This node must be like <section name="XmlConfig" type="WinApp.CustomSectionHandler,WinApp"
Which confuses me. I have traced the problem down to an XPath expression used to retrieve the config section, but it doesnt seem right to me. The Xpath expression is "/configuration/configSections/section[@name='TarponCoreConfig']"
That path doesnt make sense from the configurations I have seen in the documentation. From the reading I have done I have configured my app.config as such:
Ah! Thanks very much. I will go check out the workspace, I imagine most my problems have been had before =)
I just posted this in the workspace forum, but since I'm not sure how responsive people are there I wanted to copy it here.
I am getting the following error when I try and serialize a Hashtable that I have added a strongly typed collection object to:
An unhandled exception of type 'System.InvalidOperationException' occurred in system.xml.dll
Additional information: There was an error generating the XML document.
My collection is defined as follows:
public class ArtifactServRefCollection : CollectionBase
public void Add(ArtifactServiceReference value)
public void Insert(int index, ArtifactServiceReference value)
public ArtifactServiceReference this[int index]
return List[index] as ArtifactServiceReference;
And my ArtifactServiceReference class is simple enough, contains two properties, and is serializable.
I have tried stepping into the code, and so far it appears that the StringWriter is containing only a portion of what the full XML representation of my object would be. Are there any specifics that I need to be aware of when creating custom objects for insertion
into a hashtable that is to be serialized with this block? Right now, I am a little frustrated at my inability to determine exactly why I am having a problem in the XmlSerializer class (a core framework class). Any help is greatly appreciated.
I did some reading and it seems that the following from a post that referenced an MS document will most likely be my solution.
"Note The XmlSerializer gives special treatment to classes that
implement IEnumerable or ICollection. A class that implements
IEnumerable must implement a public Add method that takes a single
parameter. The Add method's parameter must be of the same type as is
returned from the Current property on the value returned from
GetEnumerator, or one of that type's bases. A class that implements
ICollection (such as CollectionBase) in addition to IEnumerable must
have a public Item indexed property (indexer in C#) that takes an
integer, and it must have a public Count property of type integer. The
parameter to the Add method must be the same type as is returned from
the Item property, or one of that type's bases. For classes
implementing ICollection, values to be serialized will be retrieved
from the indexed Item property, not by calling GetEnumerator."
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.