473,395 Members | 2,010 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,395 software developers and data experts.

XmlSerializer Issue

Hello,

When running the following line of code

XmlSerializer serializer = new XmlSerializer(typeof
(MyXmlTestClass));

I get the following exception message.

An unhandled exception of
type 'System.IO.FileNotFoundException' occurred in
mscorlib.dll

Additional information: File or assembly name
kq5ptvrn.dll, or one of its dependencies, was not found.

Anyone has any ideas why?

Thanks,

Nov 16 '05 #1
4 2673
BuddyWork,

When deserializing the type, the XML serializer has to have access to
the assembly that has the type in it. If you have created this XML and sent
it somewhere that does not have the type definition, you won't be able to
deserialize it. You need to make sure that the type exists on the machine
where the serialization is taking place, and the runtime can find it.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"BuddyWork" <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl...
Hello,

When running the following line of code

XmlSerializer serializer = new XmlSerializer(typeof
(MyXmlTestClass));

I get the following exception message.

An unhandled exception of
type 'System.IO.FileNotFoundException' occurred in
mscorlib.dll

Additional information: File or assembly name
kq5ptvrn.dll, or one of its dependencies, was not found.

Anyone has any ideas why?

Thanks,

Nov 16 '05 #2
sjd
Whilst it might be serialization that's at fault, maybe not. I have a case
where XmlSerializer fails, with the FileNotFound exception. However, it's
not consistent. Sometimes it works, sometimes it fails.

Because it sometimes works, it's (a) not that it can't serialize it, and (b)
not a security-related problem (because it's always run in the same
user/machine/environment). It's running zero-deployed.

Has anyone else seen this? Any ideas?

Sean
"Nicholas Paldino [.NET/C# MVP]" wrote:
BuddyWork,

When deserializing the type, the XML serializer has to have access to
the assembly that has the type in it. If you have created this XML and sent
it somewhere that does not have the type definition, you won't be able to
deserialize it. You need to make sure that the type exists on the machine
where the serialization is taking place, and the runtime can find it.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"BuddyWork" <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl...
Hello,

When running the following line of code

XmlSerializer serializer = new XmlSerializer(typeof
(MyXmlTestClass));

I get the following exception message.

An unhandled exception of
type 'System.IO.FileNotFoundException' occurred in
mscorlib.dll

Additional information: File or assembly name
kq5ptvrn.dll, or one of its dependencies, was not found.

Anyone has any ideas why?

Thanks,


Nov 16 '05 #3
I'm not sure how you are using serialization, but if you are attempting
to serialize an XML file created elsewhere into an object, there is the
possibility that your serialization will fail if the XML file doesn't
contain exactly the right data. .NET is fairly picky about the XML
serialization.

The reason you might get that error is because .NET compiles the class
on the fly, and if the XML data is wrong then it cannot compile the
class. The File Not Found error message that I've gotten is misleading.

You'd have to post some code for anybody to understand this better.

Lowell


sjd wrote:
Whilst it might be serialization that's at fault, maybe not. I have a case
where XmlSerializer fails, with the FileNotFound exception. However, it's
not consistent. Sometimes it works, sometimes it fails.

Because it sometimes works, it's (a) not that it can't serialize it, and (b)
not a security-related problem (because it's always run in the same
user/machine/environment). It's running zero-deployed.

Has anyone else seen this? Any ideas?

Sean
"Nicholas Paldino [.NET/C# MVP]" wrote:

BuddyWork,

When deserializing the type, the XML serializer has to have access to
the assembly that has the type in it. If you have created this XML and sent
it somewhere that does not have the type definition, you won't be able to
deserialize it. You need to make sure that the type exists on the machine
where the serialization is taking place, and the runtime can find it.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"BuddyWork" <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl...
Hello,

When running the following line of code

XmlSerializer serializer = new XmlSerializer(typeof
(MyXmlTestClass));

I get the following exception message.

An unhandled exception of
type 'System.IO.FileNotFoundException' occurred in
mscorlib.dll

Additional information: File or assembly name
kq5ptvrn.dll, or one of its dependencies, was not found.

Anyone has any ideas why?

Thanks,


Nov 16 '05 #4
sjd
Hey, thanks for replying!

Fristly, the thing that I didn't state; is that we ONLY see this problem
when running our application with zero-deploy. When we run local, it always
works great.

I understand the parts about accessing the type, etc,. The object we're
serializing just has a few primitives in. It is not failing serialization.
As I said, most of the time the routine works, however, occassionally, it
fails. It's not predictable.

At the point the exception is occuring, it's in the constructor of the
XmlSerializer, not the parsing. As I said, the type it's building a DLL for
is simle, just a few primitives.

We made a guess last night, as to what is happening. And for this, you need
to understand a little of how zero-deploy works. The question is, WHEN,
exactly, does XmlSerializer decide to build the .DLLs? Does it do it
everytime you run the application? Or, only once, if it decides that the
zero-deployed binaries haven't changed?

We **think** that after certain C#/.NET crashes occur, we might be getting
DLL corruption (not of the DLLs, of timestamps, or whatever). We think this
is why the XmlSerializer is failing.

Sean
"Lowell Heddings" wrote:
I'm not sure how you are using serialization, but if you are attempting
to serialize an XML file created elsewhere into an object, there is the
possibility that your serialization will fail if the XML file doesn't
contain exactly the right data. .NET is fairly picky about the XML
serialization.

The reason you might get that error is because .NET compiles the class
on the fly, and if the XML data is wrong then it cannot compile the
class. The File Not Found error message that I've gotten is misleading.

You'd have to post some code for anybody to understand this better.

Lowell


sjd wrote:
Whilst it might be serialization that's at fault, maybe not. I have a case
where XmlSerializer fails, with the FileNotFound exception. However, it's
not consistent. Sometimes it works, sometimes it fails.

Because it sometimes works, it's (a) not that it can't serialize it, and (b)
not a security-related problem (because it's always run in the same
user/machine/environment). It's running zero-deployed.

Has anyone else seen this? Any ideas?

Sean
"Nicholas Paldino [.NET/C# MVP]" wrote:

BuddyWork,

When deserializing the type, the XML serializer has to have access to
the assembly that has the type in it. If you have created this XML and sent
it somewhere that does not have the type definition, you won't be able to
deserialize it. You need to make sure that the type exists on the machine
where the serialization is taking place, and the runtime can find it.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"BuddyWork" <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl...

Hello,

When running the following line of code

XmlSerializer serializer = new XmlSerializer(typeof
(MyXmlTestClass));

I get the following exception message.

An unhandled exception of
type 'System.IO.FileNotFoundException' occurred in
mscorlib.dll

Additional information: File or assembly name
kq5ptvrn.dll, or one of its dependencies, was not found.

Anyone has any ideas why?

Thanks,

Nov 16 '05 #5

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

Similar topics

0
by: Kevin Conroy | last post by:
I'm making a 6-tiered application that is using Xml to tie the various layers together in a very clean manner. I'm also trying to do this on the 1.1 Framework although I'm willing to switch to the...
2
by: Chris Aitchison | last post by:
Hello, I am attempting to have a class that I have written serialize so that it can be both passed as a parameter or return value for a webservice, and also be serialized to disk using the...
11
by: Nick Flandry | last post by:
Hi all, When I run this code: XmlSerializer theXS; try { theXS = new XmlSerializer(typeof(TableInfo)); } catch( System.Exception eAll )
11
by: Rangi Keen | last post by:
I am instantiating an XmlSerializer using the XmlSerializer(Type) constructor. This works most of the time, but sometimes I get a timeout during the process. I'm using the same type in all cases...
4
by: Sebastien Tardif | last post by:
Subject: XmlSerializer.Deserialize complain when root declare the namespace If I do XmlSerializer.Deserialize( myString ) and myString is: String myString = "<?xml version=\"1.0\"...
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....
3
by: Don McNamara | last post by:
Hi, I've hit quite a strange problem with XmlSerializer on my W2K3 server. When I serialize/deserialize using an exe on my local computer (XP), everything works fine. When I put the code out on...
10
by: Henrik Dahl | last post by:
Hello! I have an xml schema which has a date typed attribute. I have used xsd.exe to create a class library for XmlSerializer. The result of XmlSerializer.Serialize(...) should be passed as the...
8
by: Duggi | last post by:
Hi In the following code why it is required to type cast while de- serialize... any ideas??? to create an object of XmlSerializer, Type is a compalsary parameter. Atleast by default...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
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,...
0
jinu1996
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...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.