Weird XML serialization problem



Hi All,

I am experiencing a *very* frustrating problem with XML serialization.
The background is:

1. I have version 1.0.0.0 of my product installed. All assemblies are
versioned as 1.0.0.0, and installed in a directory under Program Files
(*not* the GAC).

2. I then upgrade one of the library DLLs, My.Core.Library, to 1.0.0.1,
and install an appropriate Publisher Policy assembly in the GAC.

3. Everything works - all of my assemblies that reference
My.Core.Library use the 1.0.0.1 version. Until ...

4. ... one of the assemblies, My.Core.Administrator.Library.dll, tries
to serialize an object of type AdministratorConfig, which it contains.
Note that the My.Core.Administrator.Library.dll assembly references
My.Core.Library.

At this point, rather than being directed to the 1.0.0.1 version of
My.Core.Library, the code that's dynamically generated by the Framework
goes hunting for 1.0.0.0, and fails (see the trace at the end of this
email). Thus, the XML serialization fails, and the assembly throws an
exception.

*ARGH*!

I've checked everything. The Publisher Policy file is valid. I've
even used the XmlSerializerPreCompiler
(http://www.sellsbrothers.com/tools/#XmlSerializerPreCompiler) to
compile the serializer type in question, and I get:

"No errors producing an XmlSerializer using
My.Core.Administration.AdministratorConfig from
My.Core.Administrator.Library.dll"

.... and that's with the 1.0.0.1 version of My.Core.Library installed,
along with it's associated Publisher Policy assembly.

TIA for any help you can offer. I'm about at my wits end with this
one, and I can find *very* little documentation on MSDN about how the
dynamic serialization classes are generated.

Yours,
Duncan Bayne


The offending trace:

[292] 1) Exception Information
[292] =============================================
[292] Exception Type: My.Core.ConfigSectionWriteException
[292] SectionName: AdministratorConfig
[292] Message: The configuration file section 'AdministratorConfig'
could not be written.
[292] HelpLink: NULL
[292] Source: My.Core.Library
[292]
[292] StackTrace Information
[292] =============================================
[292] at My.Core.ConfigurationFile.WriteConfigSection(BaseConfig
section)
[292] at My.Core.GlobalConfiguration.WriteConfigSection(BaseConfig
section)
[292] at
My.Core.Administration.ProjectInstaller.OnInstall(IDictionary
savedState)
[292] at My.Library.BaseInstaller.Install(IDictionary stateSaver)
[292]
[292] 2) Exception Information
[292] =============================================
[292] Exception Type: System.InvalidOperationException
[292] Message: There was an error generating the XML document.
[292] HelpLink: NULL
[292] Source: System.Xml
[292]
[292] StackTrace Information
[292] =============================================
[292] at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter
xmlWriter, Object o, XmlSerializerNamespaces namespaces, String
encodingStyle)
[292] at System.Xml.Serialization.XmlSerializer.Serialize(TextWriter
textWriter, Object o)
[292] at My.Core.ConfigurationFile.WriteConfigSection(BaseConfig
section)
[292]
[292] 3) Exception Information
[292] =============================================
[292] Exception Type: System.IO.FileNotFoundException
[292] Message: File or assembly name My.Core.Library, or one of its
dependencies, was not found.
[292] FileName: My.Core.Library
[292] FusionLog: === Pre-bind state information ===
[292] LOG: DisplayName = My.Core.Library, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=0d9d57f6771d5752
[292] (Fully-specified)
[292] LOG: Appbase = C:\WINNT\system32\
[292] LOG: Initial PrivatePath = NULL
[292] Calling assembly : (Unknown).
[292] ===
[292]
[292] LOG: Attempting download of new URL
file:///C:/WINNT/system32/My.Core.Library.DLL.
[292] LOG: Attempting download of new URL
file:///C:/WINNT/system32/My.Core.Library/My.Core.Library.DLL.
[292] LOG: Attempting download of new URL
file:///C:/WINNT/system32/My.Core.Library.EXE.
[292] LOG: Attempting download of new URL
file:///C:/WINNT/system32/My.Core.Library/My.Core.Library.EXE.
[292]
[292] HelpLink: NULL
[292] Source: cq2e8x1x
[292]
[292] StackTrace Information
[292] =============================================
[292] at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write1_AdministratorConfig(String
n, String ns, AdministratorConfig o, Boolean isNullable, Boolean
needType)
[292] at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write7_AdministratorConfig(Object
o)

.



Relevant Pages

  • Re: Strong Name vs Serializable vs Remoting
    ... > strongly named a few assemblies. ... > With a strong name applied to my serializable library, serialization fails ... > chain on the server and I cannot reference a non-strong named assembly. ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: Tactics for Debugging Custom Components with CodeDom Serialized State
    ... >I am not sure if you used the CodeDOM serialization correct, and if CodeDOM serialization is the correct solution for serializing your objects. ... They appear in the Task List window below the design surface as "Build Errors". ... considers the two assemblies to be different, ... >When the exception throws out, in the debugger call stack window, we can get the list of exception call stack. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Remoting, AppDomains, and Exceptions
    ... double serialization of the Exception. ... Make the server assembly available to the main AppDomain (but I'm sure ... > independant assemblies which expose methods to the client. ... > The Exception object has to pass through 2 serialization rounds. ...
    (microsoft.public.dotnet.framework.remoting)
  • RE: performance of xml serilisation
    ... serialization assemblies are generated, they'll be cached and reused for ... assembly Qualified name) as the Key to cache it. ... such serialization assemblies ... are based .net AppDomain scope, that means each appdomain will has its own ...
    (microsoft.public.dotnet.framework.performance)
  • Re: Problem with serializing business object instead of core objec
    ... do this since the server does not need to know the type of object I am ... > server assembly and once in the client assembly. ... > client and server assemblies. ... >> an object instead of allowing the framework to handle the serialization so ...
    (microsoft.public.dotnet.framework.remoting)