I am serializing/deserializing a class (Class1) using the XmlSerializer
object in the System.Xml.Seri alization namespace in .Net 2.0. Class1 has
some strings and ints and two lists of other simple serializable classes
(Class2 and Class3)
Class1, Class2 and Class3 are defined in an assembly (Assembly1) which is
loaded by another assembly (Assembly2). When I statically reference
Assembly1 in Assembly2, serialization and deserialization work correctly.
When I dynamically load Assembly1 into Assembly2 using 'Assembly.Load' ,
serialization and deserialization do not work. I get the following error for
serialization:
System.InvalidO perationExcepti on: There was an error generating the XML
document. ---System.TypeInit ializationExcep tion: The type initializer for
'Microsoft.Xml. Serialization.G eneratedAssembl y.XmlSerializat ionWriterClass1 '
threw an exception. ---System.NullRefe renceException: Object reference not
set to an instance of an object.
at
Microsoft.Xml.S erialization.Ge neratedAssembly .XmlSerializati onWriterClass1. .cctor()
--- End of inner exception stack trace ---
at
Microsoft.Xml.S erialization.Ge neratedAssembly .XmlSerializati onWriterClass1. .ctor()
at
Microsoft.Xml.S erialization.Ge neratedAssembly .XmlSerializerC ontract.get_Wri ter()
at System.Xml.Seri alization.TempA ssembly.InvokeW riter(XmlMappin g mapping,
XmlWriter xmlWriter, Object o, XmlSerializerNa mespaces namespaces, String
encodingStyle, String id)
at System.Xml.Seri alization.XmlSe rializer.Serial ize(XmlWriter xmlWriter,
Object o, XmlSerializerNa mespaces namespaces, String encodingStyle, String id)
I am not sure what is happening but I tried pre-generating the serialization
assembly using Sgen and adding a reference to this assembly in Assembly1 but
I still get the same error.
Can anyone advise me what I'm doing wrong here? Thanks! 0 2478 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: HakonB |
last post by:
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...
|
by: Benjamin |
last post by:
Hi,
I'm currently writing a Web Services that interacts with a database.
To allow me to use not just one database provider (for example, I
could use MS Access, SQL Server or MySQL), the Web Service dynamically
loads up an assembly that implements an Interface I called IDatabase.
To load the assembly and create an object, I wrote this function:
private IDatabase LoadDatabasePlugin( string assemblyFile, string
|
by: Robert Magnusson |
last post by:
Hi all,
I have a healthy class defined that happily serializes and deserializes from
the underlying XML file.
The problem I hit is that, as soon as I add an implicit conversion in any of
the classes (I'm converting from my class into OleDbParameter), the
deserialization fails. The following is the error displayed when the code
fails during ASPX (C#) processing:
|
by: Michael Hoehne |
last post by:
Hi,
I'm currently facing a problem with a mixed environment using .NET 1.1 and
..NET 2.0 web services.
We have a client application (the "client", system 1) running on .NET
2.0/WinXP, calling our web service (The "Web Service Server") running on a
separate machine (also .NET 2.0, Win2003 Server, system 2).
The web service server (system 2) itself makes calls to methods in the CRM
|
by: mookid8000 |
last post by:
Hi group!
Is it possible to scan an assembly *which has NOT been added as a
reference* for types, and dynamically create instances of the loaded
types?
I have a program, MyProgram.exe, which at runtime uses
Asseembly.LoadFile(...) to load an assembly, MyAssembly.dll. When
MyAssembly.dll is added as a reference to the MyProgram project,
serialization and de-serialization works lige a charm.
| |
by: Harold Howe |
last post by:
I am having a problem deserializing objects from a library when the
following conditions exist:
1- The library is strongly named
2- The serialized file was created with version 1.0 of the assembly
3- I am trying to deserialize from an EXE that references version 2.0 of
the assembly
4- Both version 1.0 and 2.0 of the assembly reside in the GAC (no policy
redirects exist).
|
by: Smithers |
last post by:
Using 3.5, I am stuck in attempting to:
1. Dynamically load an assembly
2. Instantiate a class from that assembly (the client code is in a different
namespace than the namespace of the dynamically loaded assembly)
so far so good (per my code below)... but here is where I'm getting hung up:
3. Call methods of that type (see comments in my code)
If the types in the dynamically loaded assembly were in the same namespace
|
by: Smithers |
last post by:
I have a Windows Forms application that implements a plug-in architecture
whereby required assemblies are identified and loaded dynamically.
Here are the relevant classes:
A = application = Windows Forms class
B = a singleton hosted within A. B is responsible for dynamically loading
classes X, Y, and Z.
|
by: Jordan S. |
last post by:
I plan to load an assembly during application startup, and load that
assembly via reflection (i.e., it isn't referenced in the application's
assembly manifest). The assembly will be loaded into the application's
default app domain, with code like this:
using System.Reflection;
Assembly loadedAssembly = Assembly.LoadFile(pathToMyAssembly);
My question: When I need to access members of the assembly , how does the application know to get...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |