Hello All!
I want to store some information about application's evrironment, such as
allowed modules, application's paths, etc. For this purrpose, I created a
class called SystemEnvironment that contains all the variables I need to
store, and methods for serialization and deserialization the object.
What I want to do is to create an object with all the values I want and
serialize it into a binary file, and to this in one application called
SupportTool.
Then, I want to copy the binary file into a different application's folder
and deserialize the object into the new application, so it can get the
pre-configured preferences I set in the SupportTool.
When I tried to do so, everything went well till I tried to deserializie the
object into the new application (that contains the exact class as the
SupportTool). I got the following error message:
"An unhandled exception of type
'System.Runtime.Serialization.SerializationExcepti on' occurred in
mscorlib.dll
Additional information: Cannot find the assembly SupportTool,
Version=1.0.2011.37510, Culture=neutral, PublicKeyToken=null."
Can anyone explain me how can I perform such task?
Thanks!
Tom Rahav. 5 1073
> object into the new application (that contains the exact class as the SupportTool). I got the following error message:
What does this mean? I suspect that you added the same code to both
projects. Even though the code is the same, the types are completely
different and they cannot (de)serialize one another.
Your best bet would be to place the class you wish to (de)serialize
into its own Class Library and then reference the resultant .dll from
both project. That will ensure that the types are the same.
> object into the new application (that contains the exact class as the SupportTool).
Does this mean that you have referenced a .dll that contains the exact
class or merely added the class .vb file into the second project? If
you just added the .vb file to the second project, you are not using
the same class. It is a completely different type, even though the
code is the same.
Your best bet is to place the class you want to (de)serialize into its
own Class Library and then reference it from both projects. That will
insure that you are (de)serializing the *same* type.
Tom,
You can try this sample from Tom Shelton
(Assuming that you have set the serializable tag)
\\\
Private Function SerializeFontObject(ByVal fnt As Font) As String
Dim bf As New BinaryFormatter
Dim mem As New MemoryStream
Try
bf.Serialize(mem, fnt)
Return Convert.ToBase64String(mem.ToArray())
Catch
Return String.Empty
Finally
mem.Close()
End Try
End Function
Private Function DeserializeFontObject(ByVal fnt As String) As Font
Dim bf As New BinaryFormatter
Dim mem As New MemoryStream(Convert.FromBase64String(fnt))
Try
Return DirectCast(bf.Deserialize(mem), Font)
Finally
If Not mem Is Nothing Then
mem.Close()
End If
End Try
End Function
///
I hope this helps a little bit?
Cor
Sorry for the duplicate post. Google Groups displayed an error the
first time I submitted my post so I didn't think it got through.
Hi!
Thank you very much for your help!!
I created a new .dll file contains the class I need, added it into both
projects and it works PERFECT!
Thanks alot again for your help!
Tom.
"Tom Rahav" <to******@nospam.nospam> wrote in message
news:eF**************@TK2MSFTNGP10.phx.gbl... Hello All!
I want to store some information about application's evrironment, such as allowed modules, application's paths, etc. For this purrpose, I created a class called SystemEnvironment that contains all the variables I need to store, and methods for serialization and deserialization the object. What I want to do is to create an object with all the values I want and serialize it into a binary file, and to this in one application called SupportTool. Then, I want to copy the binary file into a different application's folder and deserialize the object into the new application, so it can get the pre-configured preferences I set in the SupportTool. When I tried to do so, everything went well till I tried to deserializie the object into the new application (that contains the exact class as the SupportTool). I got the following error message:
"An unhandled exception of type 'System.Runtime.Serialization.SerializationExcepti on' occurred in mscorlib.dll Additional information: Cannot find the assembly SupportTool, Version=1.0.2011.37510, Culture=neutral, PublicKeyToken=null."
Can anyone explain me how can I perform such task?
Thanks! Tom Rahav. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: TrvlOrm |
last post by:
HI There,
I have been struggling with JavaScript code for days now, and this is
my last resort! Please help...
I am trying to create a JavaScript slide show with links for Next
Slide,...
|
by: Timothy Shih |
last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I
wrote a simple function which takes in 2 buffers (one a byte buffer, one a
char buffer) and copies the contents of the byte...
|
by: tgregg6 |
last post by:
I need help with my problem I am stuck and I don't know what to do!!! The problem is:
This program calculates the charges for DVD rentals where current releases cost $3.5 and all others cast $2.50....
|
by: Dalton |
last post by:
This is all kind of in another language to, I mean I understand most of the words in relation to programming, but my field of work/study is IT. Anyways, on to the problem. I am working on my 5th...
|
by: =?Utf-8?B?cm9kY2hhcg==?= |
last post by:
hey all,
i have a simple user control that has a button on it which is on my web
page. everytime i click it i get the following message:
---------------------------
Error...
| |
by: lchristy0213 |
last post by:
I just started programming and I'm trying to get python to read a txt file and then turn the letters in the file into notes with certain frequencies, and then create a wav file. I'm doing ok but...
|
by: SpecialKay |
last post by:
i have a menu bar, when i run the code the first time everything is fine. If i click on the screen i print a Circle or a Square, store the shape in an arraylist and repaint the frame. When the...
|
by: DragonLord |
last post by:
Here is the situation I am inserting rows into a datagridview and then using a function to group similar rows together based on a column.
When I call to compare the lastrow with the current row...
|
by: danielmessick |
last post by:
Hey all !! I'm having a frustrating time trying to create a particular Java applet for a class.. I have no clue how to accomplish this, and really need HELP.. Anyone, PLEASE help me if you can, any...
|
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,...
|
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...
| |
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,...
|
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...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
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...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |