471,056 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,056 software developers and data experts.

XmlSerializer

jon
Hi,

I have a problem using the XmlSerializer when I switch between two
databases (SQL Server and Oracle). Very puzzling!

If my app is set for SQL Server it works fine. Basically the app has
an object model which is serialized (using the XmlSerializer) and
stored in a database table.

If I then change the configuration to Oracle the following line of code
does not work:

XmlSerializer serializer = new XmlSerializer(typeof(DebtorCycles));

The exception is as follows:

System.TypeInitializationException: The type initializer for
"System.Xml.Serialization.Compiler" threw an exception. --->
System.Configuration.ConfigurationException: Unrecognized configuration
section DBType (C:\Documents and Settings\myuser\Desktop\New
Folder\ArrearsUI.exe.config line 4)
at
System.Configuration.ConfigurationRecord.ScanSecti onsRecursive(XmlTextReade*
r
reader, String configKey)
at System.Configuration.ConfigurationRecord.Load(Stri ng filename)
at System.Configuration.DefaultConfigurationSystem.En sureInit(String
configKey)
at
System.Configuration.DefaultConfigurationSystem.Sy stem.Configuration.IConfi*
gurationSystem.GetConfig(String
configKey)
at System.Configuration.ConfigurationSettings.GetConf ig(String
sectionName)
at System.Diagnostics.DiagnosticsConfiguration.GetCon figTable()
at System.Diagnostics.DiagnosticsConfiguration.Initia lize()
at System.Diagnostics.DiagnosticsConfiguration.get_Sw itchSettings()
at System.Diagnostics.Switch.Initialize()
at System.Diagnostics.Switch.get_SwitchSetting()
at System.Diagnostics.BooleanSwitch.get_Enabled()
at System.Xml.Serialization.Compiler..cctor()
--- End of inner exception stack trace ---

Now as you can see, there's a line in the exception text that states:

"Unrecognized configuration section DBType"

DBType is a setting in an app.config file but this file is only parsed
when the initial form loads and I've ensured the XmlTextReader I'm
using is closed.

Help appreciated.
Nov 17 '05 #1
0 2085

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Bluetears76 | last post: by
3 posts views Thread by Anthony Bouch | last post: by
4 posts views Thread by Andy Neilson | last post: by
3 posts views Thread by Loui Mercieca | last post: by
4 posts views Thread by Steve Long | last post: by
reply views Thread by William Stacey [MVP] | last post: by
3 posts views Thread by kimtherkelsen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.