XML Serialization in dynamically loaded assembly

I am serializing/deserializing a class (Class1) using the XmlSerializer 
object in the System.Xml.Serialization 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.InvalidOperationException: There was an error generating the XML 
document. ---> System.TypeInitializationException: The type initializer for 
'Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterClass1' 
threw an exception. ---> System.NullReferenceException: Object reference not 
set to an instance of an object.
   at 
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterClass1..cctor()
   --- End of inner exception stack trace ---
   at 
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterClass1..ctor()
   at 
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializerContract.get_Writer()
   at System.Xml.Serialization.TempAssembly.InvokeWriter(XmlMapping mapping, 
XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String 
encodingStyle, String id)
   at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, 
Object o, XmlSerializerNamespaces 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
cmurali (1)
9/30/2008 10:37:01 AM
dotnet.xml 7266 articles. 0 followers. Follow

0 Replies
806 Views

Similar Articles

[PageSpeed] 55

Reply:

Similar Artilces:

XML Header
Hi, I have some XML doc loaded in a C# Web Service. XmlDocument doc = new XmlDocument(); doc.LoadXml(myDoc); Code Missing to manipulate header (I would like to replace or manupulate all these XXXXX): <mso-XXXXXX productversion="XXXXXX"> <mso-application progid="XXXXX"?> doc.Save(myNewDoc); Any idea on how to access and manipulate data within the doc header? Thanks vbdev vb6dev2003 wrote: > I have some XML doc loaded in a C# Web Service. > XmlDocument doc = new XmlDocument(); > doc.LoadXml(myDoc); > > Code Missing to manipulate header ...

How to add Dynamically Menu in SDI application in MFC
Hello EveryOne, I am new in MFC. I would like to ask about How to add Dynamically Menu in SDI application in MFC? I require stepwise information starting from how to create SDI application in MFC to Dyanmically Add Menu in SDI Thank You in advance I know You will help me....... kotakmayurr@gmail.com wrote: > Hello EveryOne, > > I am new in MFC. I would like to ask about How to > add Dynamically Menu in SDI application in MFC? > I require stepwise information starting from how to create SDI > application in MFC to Dyanmic...

Read XHTML into XML
Hi all, I need to read/parse XHTML aspx pages and look for certain tokens and content. How can I use a XmlTextReader for this? If not, any other ideas? Thanks in advance, JA Reyes. Jose Antonio Reyes wrote: > I need to read/parse XHTML aspx pages and look for certain tokens and > content. How can I use a XmlTextReader for this? If not, any other ideas? If the pages are well-formed XHTML then it is possible to use XmlReader (in .NET 2.0/3.0) or XmlTextReader (in .NET 1.x) to parse the XHTML documents. You can also use the other XML APIs .NET provides so using XPathNavigator and/o...

Radiant 1510 with samsung 350 serial printers
good day, Has anyone ever tried using Radiant 1510 Touchscreen moniters with samsung 350 serial printers......I am having some trouble being able to print....i have triend both the opos and windows drivers....any help would be greatly appreciated.... Best regards, Uttam Using a serial printer might be your problem. If you look through past threads you will notice a lot of the problems listed with printers show up with a serial connection. It seems to be much better to use either LPT1 or USB. You might want to consider a Serial to USB adapter and see if that works. Craig "...

Serial port
Hey, I've got an application (VC6), which must communicate with the serial port (com port). I use ReadFile, WriteFile with Non-overlapped mode. There's a thread, which is only for the reading. The problem: Missing data. Does anybody knows, how the input/output buffer of the comport is realizied? When there come more data over the ComPort then the Software reads out, what happens? Does anybody had some advices? Thanks Peter There are a variety of ways to set up reading a commport, but in general you= have to use overlapped IO. The comm port driver in effect puts data in y...

How to invoke the xml editor?
I installed vs2005 on a new xp pro machine, and installed everything except C++. When I click on a file with a ".xml" extension it is opened with IE. When I click file/Edit with XML Editor, it opens it with Notepad. If I click File/Open With and select XML Editor, it opens it with IE. So, where is the xml editor? Can it be invoked from withing VS? Where? Bill * billsahiker@yahoo.com wrote in microsoft.public.dotnet.xml: >I installed vs2005 on a new xp pro machine, and installed everything >except C++. When I click on a file with a ".xml" extension it is >opened ...

Report Load Error via CRM
I am loading a very basic report that had a complex query but works fine when running it in VS2005. When I attempt to load the report via the CRM 4.0 GUI, I get the following error message: An error has occurred. Try this action again. If the problem continues, check the Microsoft Dynamics CRM Community for solutions or contact your organization's Microsoft Dynamics CRM Administrator. Finally, you can contact Microsoft Support." This report does not have any parameters at all, and the most intense thing are embedded select statements which I have done on other reports. I have instal...

CEPC, serial KITL
Can somebody explain to the novice how to enable serial KITL in WinCE 6.0. CEPC ? My CEPC platform has an incompatible Ethernet adapter, so I am booting to MS-DOS copying NK.BIN from the network share and then staring it with loadcepc.exe It works great, I also can see debug messages on serial port. Great, however, what is the easiest way to run KITL over the serial port ? There suppose to be serial KITL implementation in CEPC BSP, but how to enable it ??? Thank you, Yan ...

Dynamic Excel
Dear All Is there anything that I can do in Excel to my Excel report dynamic? For eg... is it possible to create something which will create results based on figures keyed in... ? Any suggestions would be welcomed... It would be good if u could send me similar Excel project of yours... to me as reference... Cheers --- Message posted from http://www.ExcelForum.com/ Hi this is a little bit vague :-) maybe as a starting point: http://www.cpearson.com/excel/pivots.htm http://peltiertech.com/Excel/Pivots/pivotstart.htm http://www.contextures.com/xlPivot02.html http://www.ozgrid.com/Excel/exce...

Help: Outlook mail not loading in inbox
After clicking on send/receive... I can see the emails retrieval process in action... checking each account and listing the number of emails being retrieved. However, the emial are not displayed in any of the folders, not even the inbox. Where is my mail going... has someone highjacked my inbox? Please help... any sound advice is greatly appreciated. Micorsoft Office Outlook 2003, Windows XP iMac Lover What view do you have set on your inbox? If you use advanced find and search for items received today, do you see any items? --� Milly Staples [MVP - Outlook] Post all replies to the...

show XML schema and values
I have an XML document that looks like the following: <record> <Field1>value1</Field1> <Field2>value2</Field2> <Field3>value3</Field3> </record> What I'm aiming to do is to show the data in a report as in the following example: record: Field1 value1 Field2 value2 Field3 value3 The "Field1-3"-elements can have any name, so I'm trying to get a table that has in one result column the element name, and in the second colum...

problem when transferring out serialized item
we have a serialized item that was returned by a customer, and was placed into offline inventory. i went to offline inventory and transferred the item out, we did a standard transfer type (we are sending the item back to the supplier). after doing that, i went to the transfer out order, and selected issue all, and tried to commit to it. i get the error message "the following serial number exists in the database, and is not available for issuing: 04215494019" i checked this serial number in the serial table, and the status of the serial number is set at 3. we've never...

Offline synch using XML web-services
This is a bit long-winded. Can somebody read thru these 2 use cases, and tell me if it is feasible ? :- Use Case : Replication before Offline Synch Scenario 1 : Oracle Server , MSDE client 1. User clicks on 'Go Offline'. System creates a MSDE SQL database in laptop (client), gets the schemas of the tables in Oracle, creates corresponding tables in client's MSDE SQL (mapping Oracle datatypes to SQL datatypes). 2. Offline replication program reads in the tables of the server into a typed datasets, converts the typed datasets into XML, and stores the XML in the client. (XML serial...

XML Serialization ... how to truncate <?xml...
While xml serializing object how can I truncate <?xml ...?> this line alone? I need to send the serialized xml data to a web method ... since SOAP already have <?xml tag there was some confusion Any help would be greatly appreciated Thank you Regards Raj Raj wrote: > While xml serializing object how can I truncate <?xml ...?> this line alone? Serialize to an XmlWriter created with XmlWriterSettings where you set OmitXmlDeclaration to true. -- Martin Honnen --- MVP XML http://msmvps.com/blogs/martin_honnen/ ...

String to xml document
Hi there, I was hoping someone can help me with a little problem I can't seem to find any answers to. I've got a form wich will be posted. On receiving the post I would like to parse a formvar to a xml document. The contents of this formvar (string) will be a valid xhtml document. Can someone give me a startertip (or more :-)) on how to achieve this? tnx in advance, James van der Veen Sjeems wrote: > I was hoping someone can help me with a little problem I can't seem to find > any answers to. > > I've got a form wich will be posted. On receiving the p...

Beginner of XML
I am a beginner of XML. I want to group some files together with a xml file. (it includes a text file, and an image file and a video file) Can someone show me some guidelines? Please help. ...

Valid xml to read from an xml file?
I'm using vb.net, i get an error at the reader line saying the remote server can't be found. Is the below even valid? dim reader as XmlTextReader reader = new XmlTextReader ("http://www.mysite.com/my.xml") do while (reader.Read()) 'do some action here response.write(reader) loop thanx chumley XmlTextReader uses System.Net.WebRequest under the covers -- see if you can figure out how to create a connection that way. Usually there's some proxy server information missing that you can enable if you use WebRequest directly, and then pass the result of GetResponse()...

down load mircosoft publisher 2003
I have microsoft publisher 2000 and would like to up-grade it to microsoft publisher 2003. Here is one place you can download Microsoft Publisher 2003 for a price. I don't know if this is legit or not but something to look into. http://www.bizrate.com/computers_software/search__keyword--microsoft+publisher+2003__lp--1__sfsk--1.html Bottom of the page. -- Don Vancouver, USA "Jeanne" <Jeanne@discussions.microsoft.com> wrote in message news:311016B4-4D98-4916-BE91-9D32DD18E8B4@microsoft.com... >I have microsoft publisher 2000 and would like to up-grade it to mi...

Example eConnect XML documents
MSDN says the following: Installing eConnect schema When you include the schemas component of the eConnect install, the installer places schema files in a schemas folder on your computer. The following schema resources are available: The install places the .xsd schema files in the directory c:\Program Files\Microsoft Great Plains\eConnect9\XML Schema\Incoming XSD Individual Schemas. The files in the directory contain the schema for each eConnect XML document. The install places a file named eConnect.xsd that contains the schema definition for all eConnect XML documents. The install typicall...

Saving DataSet as XML in ADO format using VB.NET
Hi, I am trying to convert a lot of web reports from ASP/VB to ASP.NET/VB.NET. I would like to save my dataset in XML and then use XSLT to transform the XML. The catch is I would like to have the XML in the format that ADO uses versus the default format in which ADO.NET uses. Currently, I am using ADO within .NET, but I am concerned about the performance and it might improve if I used the native data providers for .NET. I am not sure if I am missing something but how do I save the .NET DataSet to XML in the OLD ADO format? Thanks for you help in advance and it is most appreciated. In the ...

Can you load pre-GP sales history?
When converting to GP from another system, is it possible to load historical sales data (assuming the invoices are all paid)? We'd like to be able to create life-to-date detailed sales reports for our customers, but in order to do so we'd have to load their purchases prior to our installation of GP. -- Bud Cool, Accounting System Manager HDA, Inc. Hazelwood, MO GP 9.0, SP2 Sure! Simply import the transactions. "Bud" wrote: > When converting to GP from another system, is it possible to load historical > sales data (assuming the invoices are all paid)? > ...

Mixed DLL Loading Problem.
Hi, Forgive me if this has been all hashed out somewhere. I am using Visual Studio 2003. I am using the book "Programming Microsoft DirectShow for Digital Video and Television". I have used Chapter 10 to learn enough to write a DirectShow Transform Filter COM DLL. That part worked OK. Then I wanted to add an IID_ interface. I needed a static variable in the DLL to hold a value that I want to pass in through the IID_ interface. That's when I discovered the linker error caused by MSIL whacko stuff apparently introduced in the first .NET compiler... :-) (LNK4210 &#...

XML variable for description on receipt?
Hi, I would like to add a description (actually all of those 3 extended descriptions) to display on the printed receipt under the main description. What is the variable to do that? Entry.Item.Description Entry.Item.ExtendedDescription Entry.Item.SubDescription1 Entry.Item.SubDescription2 Entry.Item.SubDescription3 R. "Zorian" <Zorian@discussions.microsoft.com> wrote in message news:F4425EAC-62B6-46FE-826A-D8BA2AA75DBB@microsoft.com... > Hi, I would like to add a description (actually all of those 3 extended > descriptions) to display on the printed receipt un...

How to load page with specific date?
Does anyone have any suggestions on how to load page with specific date? For example, https://fx2.oanda.com/user/interestrate.html, I need to manually input date, which starting from 1/1/1970 to today() or 2/2/2010. Does anyone have any suggestions on how to load this page into excel? Thanks in advance for any suggestions Eric I only selected US currency although you could select multiple currencies Sub OANDA() URL = "https://fx2.oanda.com/user/interestrate.html" StartDate = "01/01/1970" EndDate = "02/02/2010" MyCurrency = "US DOLL...

xml to SQL
Hey we have a project in which a company produces a XML page in reply to actions on it's site. I see that SQL 2000 works well with XML so Can someone point me in the right direction, I would like to take the XML from thier SQL and have it "post" to own sql server (add,create, data, modifity and delete data on the fly). I was looking at doing XML to HTML and then passing to some a ASP but if we can grab from the responsetext then we could save time and headaches. Now I really know next to nothing about XML but I am reading all the newsgroups and pulled now TONS of xml / sql stuff ...