By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,633 Members | 1,856 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,633 IT Pros & Developers. It's quick & easy.

XmlSerializer Issue

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.