473,320 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

XMLSerializer and Parametersless Constructors

I have an ASP.NET custom control that has to serialize the following
class in order to save it to view state. If I leave out the
parameterless constructor I get:

System.IO.FileNotFoundException: File or assembly name luasprru.dll,
or one of its dependencies, was not found.

It works if I include a parameterless constructor. Most of the
postings regarding this type of error involve incorrect security
settings for the Windows temp folder, assembly files, or conflicting
..NET versions. None of these resolved my issue, only adding the
parameterless constructor did. Does anyone know why? Thanks.

-------------------------

using System;
using System.Xml;
using System.Collections;
using System.IO;

namespace WebControls.Common
{
/// <summary>
/// Summary description for DbSchema.
/// </summary>
public class DbSchema
{
private Database _database;

// Required constructor for serializing:
public DbSchema()
{
}
public DbSchema(Database database)
{
_database = database;
GetSchema();
}

public string DatabaseName
{
get{return _database.Name;}
set{_database.Name = value;}
}

protected void GetSchema()
{
// (...)
}
}
}
Nov 18 '05 #1
2 1505
"Michael Brockman" <fa********@cox.net> wrote in message news:f1**************************@posting.google.c om...
If I leave out the parameterless constructor I get:

System.IO.FileNotFoundException: File or assembly name luasprru.dll,
or one of its dependencies, was not found. : : None of these resolved my issue, only adding the
parameterless constructor did. Does anyone know why?


In order to be serializable (whether binary or XML serializable) a class
must have a default (parameterless) constructor.

Serializers work by creating an empty instance of your class. It won't
know what parameterized constructor to call to obtain such an empty
object ... therefore you must provide a default constructor. This is the
constructor a serializer counts on being there.
Derek Harmon
Nov 18 '05 #2
Thanks for the clarification Derek. I suppose the fact that the
serializer couldn't create an empty instance lead to the
FileNotFoundException which was misleading me.

Michael Brockman

"Derek Harmon" <lo*******@msn.com> wrote in message news:<OH**************@TK2MSFTNGP10.phx.gbl>...
"Michael Brockman" <fa********@cox.net> wrote in message news:f1**************************@posting.google.c om...
If I leave out the parameterless constructor I get:

System.IO.FileNotFoundException: File or assembly name luasprru.dll,
or one of its dependencies, was not found.

: :
None of these resolved my issue, only adding the
parameterless constructor did. Does anyone know why?


In order to be serializable (whether binary or XML serializable) a class
must have a default (parameterless) constructor.

Serializers work by creating an empty instance of your class. It won't
know what parameterized constructor to call to obtain such an empty
object ... therefore you must provide a default constructor. This is the
constructor a serializer counts on being there.
Derek Harmon

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jim Cobban | last post by:
I must be missing something. I am using org.apache.xml.serialize.XMLSerializer to save a DOM but I am not getting non-basic characters converted to UTF-8. I create Text nodes in the DOM by,...
5
by: Stuart Robertson | last post by:
I am trying to find a solution that will allow me to use XmlSerializer to serialize/deserialize a collection of objects where a given object is shared between two or more other objects, and not...
1
by: Bluetears76 | last post by:
Hi I have a hirachy of classes which are Message(base), then FileMessage and ChatMessage (extended) I want to serialize the objects and when i am deserizaling i dont know if i am getting...
0
by: Magne Ryholt | last post by:
Have a class with a public property named "TheFirstPropertyOfArrayListType" of type ArrayList, property has attribute XmlElement to describe the contents of the ArrayList, the contents is a public...
2
by: Mike LeBlanc | last post by:
Hi, I have a desired xml output that looks like this <?xml version="1.0" encoding="UTF-8"?><onhand_request><item organization_id="414">1</item><item...
3
by: Loui Mercieca | last post by:
Hi, I have created a class, named FormField , which basically contains two fields, name and value. I have set the tag before the class and the field is set as an XmlAttribute whil the name as...
12
by: SJD | last post by:
I've just read Christoph Schittko's article on XmlSerializer: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/trblshtxsd.asp . . . and very informative it is too....
4
by: Steve Long | last post by:
Hello, I hope this is the right group to post this to. I'm trying to serialize a class I've written and I'd like to be able to serialze to both binary and xml formats. Binary serialization is...
2
by: RRB | last post by:
Hi, I have a class library in which I have classes which implement ISerializable. They all have GetObjectData implementations and constructors to support deserialization. In unit testing this...
0
by: =?Utf-8?B?QW1hemVkc2FpbnQ=?= | last post by:
The simple constructors of XMLSerializer class caches the typed serializer once it is generated. (Probably as you know, other XMLSerializer constructors will result in a memory leak because they...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.