Hi all
I get an exception when trying to deserialize a simple configuration file
using XML Serialization. The very long stacktrace can be seen at the bottom
of this message. I've see other messages related a similar error but none
of the solutions suggested are valid in case :/
I have tracked the problem down to the compilation of the temporary DLL that
handles the actual serialization. The following commandline (that is one
single line) is executed by the framework when trying to deserialize my configuration:
"c:\windows\microsoft.net\framework\v1.1.4322\csc. exe" /t:library /utf8output
/R:"c:\windows\assembly\gac\system.xml\1.0.5000.0__ b77a5c561934e089\system.xml.dll"
/R:"c:\program files\MyApp\MyConfig.dll" /R:"c:\windows\microsoft.net\framework\v1.1.4322\ms corlib.dll"
/out:"C:\DOCUME~1\User\LOCALS~1\Temp\i2_6axn4.dll" /debug- /optimize+ /w:1
"C:\DOCUME~1\User\LOCALS~1\Temp\i2_6axn4.0.cs"
Note that it uses the .NET 1.1 compiler and core lib but references the .NET
1.0 XML assembly. The result is that the assembly isn't created and hence
cannot be loaded.
I've specifeid the required runtime version in the .config file to be .NET
1.1 without any improvements.
The problems occur on a Windows XP test machine with both .NET 1.0 and 1.1.
The application is built using VS.NET 2003 on a machine with only .NET 1.1.
The user running the code on the test machine has administrative rights.
I've have tried the XmlSerialization precompiler and it works without problems...
Anyone have any ideas why this happens?
Kind regards,
HakonB
Exception:
System.Configuration.ConfigurationException: Unable to load configuration
from the XML configuration file: 'C:\Program Files\MyApp\MyApp.exe.config'.
This can be caused by a number of problems, but the most common problem
is an incorrectly configured Updater configuration file.
The most probable sources of error are: missing nodes, incorrect
attribute names, white space within attributes or within elements,
white space between elements in the same sub-node, badly formed xml,
or xml that does not conform to the ConfigSchema.XSD. ---> System.Configuration.ConfigurationException:
Exception in configuration section handler (C:\Program Files\MyApp\MyApp.exe.config
line 16) ---> System.IO.FileNotFoundException: File or assembly name _zdvwu31.dll,
or one of its dependencies, was not found. File name: "_zdvwu31.dll"
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase,
Boolean isStringized, Evidence assemblySecurity, Boolean throwOnFileNotFound,
Assembly locationHint, StackCrawlMark& stackMark)
at System.Reflection.Assembly.InternalLoad(AssemblyNa me assemblyRef, Boolean
stringized, Evidence assemblySecurity, StackCrawlMark& stackMark)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef, Evidence assemblySecurity)
at System.CodeDom.Compiler.CompilerResults.get_Compil edAssembly()
at System.CodeDom.Compiler.CompilerResults.get_Compil edAssembly()
at System.Xml.Serialization.Compiler.Compile()
at System.Xml.Serialization.TempAssembly..ctor(XmlMap ping[] xmlMappings)
at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
at System.Xml.Serialization.XmlSerializer..ctor(Type type)
at DSUpdater.UpdaterSectionHandler.System.Configurati on.IConfigurationSectionHandler.Create(Object
parent, Object configContext, XmlNode section) in C:\Projects\MyApp\MyApp\ConfigSectionHandler.cs:li ne
55
at System.Configuration.ConfigurationRecord.EvaluateR ecursive(IConfigurationSectionHandler
factory, Object config, String[] keys, Int32 iKey, XmlTextReader reader)
=== Pre-bind state information ===
LOG: Where-ref bind. Location =
C:\DOCUME~1\User\LOCALS~1\Temp\_zdvwu31.dll
LOG: Appbase = C:\Program Files\MyApp\
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: Policy not being applied to reference at this time (private,
custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL
file:///C:/DOCUME~1/User/LOCALS~1/Temp/_zdvwu31.dll.
--- End of inner exception stack trace ---
at
System.Configuration.ConfigurationRecord.EvaluateR ecursive(IConfigurationSectionHandler
factory, Object config, String[] keys, Int32 iKey, XmlTextReader reader)
at System.Configuration.ConfigurationRecord.Evaluate( String configKey)
at System.Configuration.ConfigurationRecord.ResolveCo nfig(String configKey)
at System.Configuration.ConfigurationRecord.GetConfig (String configKey)
at System.Configuration.DefaultConfigurationSystem.Sy stem.Configuration.IConfigurationSystem.GetConfig( String
configKey)
at System.Configuration.ConfigurationSettings.GetConf ig(String sectionName)
at DSUpdater.UpdaterConfiguration.Init() in C:\Projects\MyApp\MyApp\UpdaterConfiguration.cs:li ne
133
--- End of inner exception stack trace ---
at DSUpdater.ApplicationUpdateManager..ctor() in C:\Projects\MyApp\DSUpdater\ApplicationUpdater.cs: line
98
at MyApp.Client.Services.SmartUpdateService.Initializ e(Form form) in C:\Projects\MyApp\MyApp\Services\SmartUpdateServic e.cs:line
32
at MyApp.Client.MainForm.Handler_CheckForUpdates(Obje ct sender, EventArgs
e) in C:\Projects\MyApp\MyApp\MainForm.cs:line 570
at MyApp.Common.ActionHandler.ExecuteHandler(Object sender, EventArgs args)
in C:\Projects\MyApp\MyCommon\General\ActionDispatche r.cs:line 252
at MyApp.Common.General.ActionDispatcher.Fire(String handlerName, Object
sender, EventArgs args) in C:\Projects\MyApp\MyCommon\General\ActionDispatche r.cs:line
195
at MyApp.Client.MainForm.MainForm_Load(Object sender, EventArgs e) in C:\Projects\MyApp\MyApp\MainForm.cs:line
423
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr
wparam, IntPtr lparam)