Serialize and Deserialize problem ~

B

Bsiang Tan

I try to serialize my object into xml
it work, but I can't deserialize it back.

I get an exception.. :-

An unhandled exception of type 'System.Reflection.TargetInvocationException'
occurred in mscorlib.dll

Additional information: Exception has been thrown by the target of an
invocation.


My serialize code :

Stream writer = File.Create(saveFileDialog.FileName);
SoapFormatter fmt = new SoapFormatter();
fmt.Serialize(writer, this.dataBean);

My deserialize code :

Stream reader = File.OpenRead(openFileDialog.FileName);
SoapFormatter fmt = new SoapFormatter();
DataBean data = (DataBean) fmt.Deserialize(reader);


Could anyone help please...........
thank you a lot ~

Best regard,
Bsiang
 
V

Vadym Stetsyak

can you post the code of DataBean?

The exception you've encountered is thrown by your class DataBean when it is
instantiated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top