473,548 Members | 2,683 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XmlSerializer Issue

Hello,

When running the following line of code

XmlSerializer serializer = new XmlSerializer(t ypeof
(MyXmlTestClass ));

I get the following exception message.

An unhandled exception of
type 'System.IO.File NotFoundExcepti on' 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 2685
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.co m

"BuddyWork" <an*******@disc ussions.microso ft.com> wrote in message
news:05******** *************** *****@phx.gbl.. .
Hello,

When running the following line of code

XmlSerializer serializer = new XmlSerializer(t ypeof
(MyXmlTestClass ));

I get the following exception message.

An unhandled exception of
type 'System.IO.File NotFoundExcepti on' 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.co m

"BuddyWork" <an*******@disc ussions.microso ft.com> wrote in message
news:05******** *************** *****@phx.gbl.. .
Hello,

When running the following line of code

XmlSerializer serializer = new XmlSerializer(t ypeof
(MyXmlTestClass ));

I get the following exception message.

An unhandled exception of
type 'System.IO.File NotFoundExcepti on' 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.co m

"BuddyWork" <an*******@disc ussions.microso ft.com> wrote in message
news:05****** *************** *******@phx.gbl ...
Hello,

When running the following line of code

XmlSerialize r serializer = new XmlSerializer(t ypeof
(MyXmlTestCl ass));

I get the following exception message.

An unhandled exception of
type 'System.IO.File NotFoundExcepti on' occurred in
mscorlib.d ll

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.co m

"BuddyWork" <an*******@disc ussions.microso ft.com> wrote in message
news:05****** *************** *******@phx.gbl ...

Hello,

When running the following line of code

XmlSerialize r serializer = new XmlSerializer(t ypeof
(MyXmlTestCl ass));

I get the following exception message.

An unhandled exception of
type 'System.IO.File NotFoundExcepti on' occurred in
mscorlib.d ll

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
1754
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 1.0 Framework if need be. One layer, which I call a Data Persistence Layer, uses the System.Xml.Serialization.XmlSerializer to transform our...
2
6800
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 XmlSerializer. When this class is decalred as a return value for a WebMethod in an XML WebService I receive the following exception: ...
11
2357
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
6606
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 and it has happened on multiple computers ranging from 500 MHz to 2.6 GHz. Does anyone know why the csc.exe process would time out in this case? It...
4
11788
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\" encoding=\"utf-16\"?><DocumentResponse ><documentSize xmlns=\"urn:webservices.docharbor.com\">23</documentSize></DocumentResponse>"; It's working
12
8464
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. I, too, am getting nasty FileNotFound exceptions. I've read, and digested the article, and I think I've found a bug -- it's difficult to track,...
3
3157
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 the server (W2K3) it throws an exception. It only seems to happen when serializing/deserializing _arrays_ of a type. If I just serialize/deserialize...
10
4766
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 value for the parameter of an SqlCommand for inserting the xml document in a column of a table where the column is typed to be of the same xml...
8
174
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 XmlSerializer should convert it to the Type it is made for... class MyClass
0
7512
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7438
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7707
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7466
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7803
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5362
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3495
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3475
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1926
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.