473,835 Members | 1,836 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem With serialization

I get an System.IO.FileN otFoundExceptio n when trying to serialize data.
The "not found file" is a random name .dll

after doing some Google, if found this article:
http://weblogs.asp.net/cschittko/articles/33045.aspx

I am not expirenced enough to do the testing, which is described there.

But according to it, maybe my XmlSerializer can't serialize my data.

I took the code from a book and I thought it should work.

here is the code:

=============== =============== ===========

Public Enum purchaseOrderSt ates
ISSUED
DELIVERED
INVOICED
PAID
End Enum
<Serializable() > _
Public Class company
Public name As String
Public address As String
Public phone As String
End Class
<Serializable() > _
Public Class lineItem
Public description As String
Public quantity As Integer
Public cost As Double
End Class
<Serializable() > _
Public Class purchaseOrder
Private _purchaseOrderS tatus As purchaseOrderSt ates
Private _issuanceDate As DateTime
Private _deliveryDate As DateTime
Private _invoiceDate As DateTime
Private _paymentDate As DateTime
Public buyer As company
Public vendor As company
Public reference As String
Public items() As lineItem
Public Sub New()
_purchaseOrderS tatus = purchaseOrderSt ates.ISSUED
_issuanceDate = DateTime.Now
End Sub

Public Sub recordDelivery( )
If _purchaseOrderS tatus = purchaseOrderSt ates.ISSUED Then
_purchaseOrderS tatus = purchaseOrderSt ates.DELIVERED
_deliveryDate = DateTime.Now
End If
End Sub
Public Sub recordInvoice()
If _purchaseOrderS tatus = purchaseOrderSt ates.DELIVERED
Then
_purchaseOrderS tatus = purchaseOrderSt ates.INVOICED
_invoiceDate = DateTime.Now
End If
End Sub
Public Sub recordPayment()
If _purchaseOrderS tatus = purchaseOrderSt ates.INVOICED Then

_purchaseOrderS tatus = purchaseOrderSt ates.PAID
_invoiceDate = DateTime.Now
End If
End Sub
End Class
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim Vendor As company = New company
Dim Buyer As company = New company
Dim Goods As lineItem = New lineItem
Dim po As purchaseOrder = New purchaseOrder
Vendor.name = "Acme Inc."
Buyer.name = "Wiley E. Coyote"
Goods.descripti on = "anti-RoadRunner cannon"
Goods.quantity = 1
Goods.cost = 599.99
po.items = New lineItem(1) {}
po.items(0) = Goods
po.buyer = Buyer
po.vendor = Vendor
Dim xs As XmlSerializer = New XmlSerializer(p o.GetType())
Dim fs As FileStream = File.Create("C: \po.xml")
xs.Serialize(fs , po)
fs.Close()
End Sub

Nov 12 '05 #1
2 1129
"Nikolay Petrov" <jo******@mail. bg> wrote in message news:11******** **************@ l41g2000cwc.goo glegroups.com.. .
I get an System.IO.FileN otFoundExceptio n when trying to serialize data.
The "not found file" is a random name .dll : : Dim xs As XmlSerializer = New XmlSerializer(p o.GetType())
Dim fs As FileStream = File.Create("C: \po.xml")


If this is an ASP.NET application, make sure the ASPNET logon (aka,
ASPNET on .NET 1.0, IWAM_{InsertYou rMachineNameHer e} on
..NET 1.1) has permission to read, write and create files in it's TEMP
folder (for instance, C:\Windows\Temp ). That's where the dynamically
generated assembly containing the XmlSerializatio nReader/Writer is
going to be placed, and if you don't have permission to save it there
then it won't be found.
Derek Harmon
Nov 12 '05 #2
it is winforms app and it is run from admin account
no permissions issue

Nov 12 '05 #3

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

Similar topics

4
2115
by: David K | last post by:
we are having a problem when trying to serilalize and deserialize DataTable When replacing the container to be ListArray or HashTable everything works fine The code is very straight forward ( see below), however when comparing the DataTable before and after the serialize, it is not the same The DataTable after the serialization contains only the string of class type ( Vclass in this class) but not the class itself Any idea ?
1
4366
by: andrewcw | last post by:
There is an error in XML document (1, 2). I used XML spy to create the XML and XSD. When I asked to have the XML validated it said it was OK. I used the .net SDK to generate the class. I have done this before but this time I have no idea why I am getting the error. Any ideas ?? THANKS ! <qcsttatus> <manual sourcerootfolder="" manualname="">
4
1805
by: james | last post by:
I upgraded my 2002 project to 2003 and I am getting several of there errors on my forms xxxForm.resx Resource transformation for file 'xxxForm.resx' failed. Possible Version mismatch. Type System.Globalization.DateTimeFormatInfo has 38 members, number of members deserialized is 35. Now, when I open the .resx files I do not find any DateTimeFOrmatInfo members in the XML or in the code.
2
2359
by: ofer | last post by:
Hi, I am working with the beta version of the new .net framework (Whidbey) and I encountered a problem with serialization that did'nt exist in the .net 2003 the situation is like this : I have a class that inherits from dataset, and I want to serialize it , so I created a serialization constructor that forwards the call to the base class (the dataset) serialization constructor, normally, for this action to succeed I am supposed to put...
0
2507
by: umhlali | last post by:
I get the following exception when my VB.NET app calls a Java web service that returns an array of objects. The same call works for a single object though. So looks like there is no problem serializing the object but there seems to be a problem serializing an array of objects. Any help will be appreciated "Cannot assign object of type System.Object to an object of type ElectronicWallet.C2PTest.PaymentItem." :...
0
912
by: ZippyV | last post by:
Hello everybody, I'm trying to convert a given xsd scheme to vb.net code with the help of xsd.exe. I've had no problems during conversion but the problem is that I can't build the code in vs.net. I keep getting the error: "Reference to a non-shared object requires an object reference". The weird thing is that this problem doesn't occur in every Class in that vb-file. I don't have a clue how to fix this problem. Here is one of the...
2
2761
by: yqlu | last post by:
I hava developed a client in C# that is connected to a 3-party XML Web Services developed in Java based on the AXIS 1.1. Most methods call are successful except for one method named "findObjects" and return a complex type "FieldSearchResult". The error message as following : "Cannot assign object of type System.String to an object of type System.String. There is an error in XML document (23, 97)." By the way,I hava written a client in Java...
5
19605
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was having a problem in the calling program. I searched online and found suggestions that I return an Array instead so I modified my code (below) to return an Array instead of an ArrayList. Now I get the message when I try to run just my webservice...
2
1636
by: Norman Chong | last post by:
Hiddeldi ho, I want to save an object so that I can use its content after I restart my program. I tried to solve this with serialization because someone told me that this is the correct way for this. So I wrote the following code to serialize\deserialize the object, but now I have the problem that the object has a generic list and when I'm trying to deserialize it, I get an error. <System.Serializable()Public Class TestClass
2
5569
by: mkvenkit.vc | last post by:
Hello, I hope this is the right place to post a question on Boost. If not, please let me know where I can post this message and I will do so. I am having a strange problem with std::string as I am trying to read from a binary archive using Boost serialization. I am new to this, and it is possible that I have not understood the usage. In the code below, the string "faultblock" seems to be causing the problem. The code crashes in the ia...
0
9653
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10815
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10524
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10562
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10236
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7768
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5805
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4434
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
2
3997
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.