Wrox Programmer Forums
|
BOOK: Professional Microsoft SQL Server 2008 Integration Services ISBN: 978-0-470-24795-2
This is the forum to discuss the Wrox book Professional Microsoft SQL Server 2008 Integration Services by Brian Knight, Erik Veerman, Grant Dickinson, Douglas Hinson, Darren Herbold; ISBN: 9780470247952
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Microsoft SQL Server 2008 Integration Services ISBN: 978-0-470-24795-2 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 7th, 2009, 04:47 PM
Registered User
 
Join Date: Feb 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 9 - Example: Serializing Data to XML

I am having a problem getting the example code to work in C# for "Chapter 9 - Example: Serializing Data to XML". The code compiles fine, but I hit a runtime exception.

Where the code is having a problem is:

XmlSerializer ser = newXmlSerializer(typeof(List<SSISSetting>));
ser.Serialize(outfile, arrayListSettings);

The exception I get is:

Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: There was an error generating the XML document. ---> System.TypeInitializationException: The type initializer for 'Microsoft.Xml.Serialization.GeneratedAssembly.Xml SerializationWriterList1' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationWriterList1..cctor()
--- End of inner exception stack trace ---
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationWriterList1..ctor()
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializerContract.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(X mlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Serialize(X mlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
at System.Xml.Serialization.XmlSerializer.Serialize(T extWriter textWriter, Object o, XmlSerializerNamespaces namespaces)
at System.Xml.Serialization.XmlSerializer.Serialize(T extWriter textWriter, Object o)
at ST_6bd1677c45cf423d90fbdb388871e8ad.csproj.ScriptM ain.doClass1()
at ST_6bd1677c45cf423d90fbdb388871e8ad.csproj.ScriptM ain.Main()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Objec t target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskS criptingEngine.ExecuteScript()


Can you help?

Thank you
 
Old March 1st, 2012, 08:01 AM
Registered User
 
Join Date: Mar 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question Same Error in the C# Script

Hi,

I'm getting the same error in the C# script.

Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: There was an error generating the XML document. ---> System.TypeInitializationException: The type initializer for 'Microsoft.Xml.Serialization.GeneratedAssembly.Xml SerializationWriterList1' threw an exception....

Please could you provide a fix?

Thanks in advance,






Similar Threads
Thread Thread Starter Forum Replies Last Post
Serializing object into existing XmlTextWriter planoie .NET Framework 2.0 0 October 15th, 2007 09:54 AM
why serializing class? hertendreef ASP.NET 1.0 and 1.1 Basics 5 March 25th, 2007 11:47 AM
Serializing headers in VB.NET PMNorris XML 0 January 5th, 2004 08:02 AM
Chapter 12 ex1 Serializing objects gillianbc BOOK: Beginning Java 2 1 December 14th, 2003 12:23 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.