473,395 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Unable to Serialize

I am getting the error:

Unable to serialize the session state. Please note that non-serializable
objects or MarshalByRef objects are not permitted when session state mode is
'StateServer' or 'SQLServer'.

I have a .DLL that has 4 classes:

<Serializable()Public Class POP3Client
<Serializable()Public Class EMail
<Serializable()Public Class SMTPClient
<Serializable()Public NotInheritable Class MailAttachment

The only Class I am trying to put in a session is a POP3Client object. But
I am getting this error. The .DLL compiles fine with no errors. So why
would I get this error????

Thanks,

Tom
Feb 2 '07 #1
3 2300
I also am using Sockets as I am getting mail from our Exchange Server.

Could this be part of the problem?

Thanks,

Tom

"tshad" <t@home.comwrote in message
news:Or**************@TK2MSFTNGP03.phx.gbl...
>I am getting the error:

Unable to serialize the session state. Please note that non-serializable
objects or MarshalByRef objects are not permitted when session state mode
is 'StateServer' or 'SQLServer'.

I have a .DLL that has 4 classes:

<Serializable()Public Class POP3Client
<Serializable()Public Class EMail
<Serializable()Public Class SMTPClient
<Serializable()Public NotInheritable Class MailAttachment

The only Class I am trying to put in a session is a POP3Client object.
But I am getting this error. The .DLL compiles fine with no errors. So
why would I get this error????

Thanks,

Tom

Feb 2 '07 #2
the serialization code is generated at runtime, the first time you ask
an object to be serialized, so serialization error are only found at
runtime.

the <Serializableattribute declares the class serializable, it does
nothing else, it will not make it magically so. if its your own class
you may be able to make it serializable by property attributes or
writing your own serialization code.

if your class is really a pop3 connection, to serialize you will need to
store the connection state, and reopen the connection on in your
deserialization code.

-- bruce (sqlwork.com)

tshad wrote:
I am getting the error:

Unable to serialize the session state. Please note that non-serializable
objects or MarshalByRef objects are not permitted when session state mode is
'StateServer' or 'SQLServer'.

I have a .DLL that has 4 classes:

<Serializable()Public Class POP3Client
<Serializable()Public Class EMail
<Serializable()Public Class SMTPClient
<Serializable()Public NotInheritable Class MailAttachment

The only Class I am trying to put in a session is a POP3Client object. But
I am getting this error. The .DLL compiles fine with no errors. So why
would I get this error????

Thanks,

Tom

Feb 2 '07 #3

"bruce barker" <no****@nospam.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
the serialization code is generated at runtime, the first time you ask an
object to be serialized, so serialization error are only found at runtime.

the <Serializableattribute declares the class serializable, it does
nothing else, it will not make it magically so. if its your own class you
may be able to make it serializable by property attributes or writing your
own serialization code.

if your class is really a pop3 connection, to serialize you will need to
store the connection state, and reopen the connection on in your
deserialization code.
Here is a portion of my code:
************************************************** ******

Imports System.Net
Imports System.Net.Sockets
Imports System.Text
Imports System.Threading
Imports System.IO
Imports System.Collections.Specialized

<Serializable()Public Class POP3Client
Protected sockPOP3 As Socket
Protected m_Port As Int16 = 110 'Use default POP3 port 110
Protected m_Remote As IPEndPoint
Protected m_User As String
Protected m_Pass As String
Protected m_arrMailList As New ArrayList
Protected m_WaitBeforeReceive As Boolean = True

Protected Const SendBufferLength As Int16 = 1023
Protected Const ReceiveBufferLength As Int32 = 65535

Private bufferReceive(ReceiveBufferLength) As Byte
Private bufferSend(SendBufferLength) As Byte
Public Sub New()
sockPOP3 = New Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp)
sockPOP3.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.ReceiveTimeout, 60000) 'Timeout: 60 sec
sockPOP3.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.SendTimeout, 60000) 'Timeout: 60 sec
End Sub

************************************************** ******

Are you saying I need to tak the Socket section out of my code since it has
the connection information in it and do something else with it?

Thanks,

Tom
>
-- bruce (sqlwork.com)

tshad wrote:
>I am getting the error:

Unable to serialize the session state. Please note that non-serializable
objects or MarshalByRef objects are not permitted when session state mode
is 'StateServer' or 'SQLServer'.

I have a .DLL that has 4 classes:

<Serializable()Public Class POP3Client
<Serializable()Public Class EMail
<Serializable()Public Class SMTPClient
<Serializable()Public NotInheritable Class MailAttachment

The only Class I am trying to put in a session is a POP3Client object.
But I am getting this error. The .DLL compiles fine with no errors. So
why would I get this error????

Thanks,

Tom

Feb 2 '07 #4

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

Similar topics

5
by: David Sworder | last post by:
Hi, I've created a UserControl-derived class called MyUserControl that is able to persist and subsequently reload its state. It exposes two methods as follows: public void Serialize(Stream...
0
by: Javad Vakil via .NET 247 | last post by:
(Type your message here) -------------------------------- From: Javad Vakil I am having problem Serializing. I have written a DLL which runsinside another program (Add-in). When I try to save...
2
by: Dave | last post by:
We just started getting this error message in our application today (stack trace below). From the OutOfMemoryException, I'm guessing it could be a memory leak. I'm making sure I'm closing all my...
1
by: js | last post by:
Does anybody knows how to solve the problem? I added attribute to the following classes in Microsoft.Practices.EnterpriseLibrary.Data namespace, but I still get the error. Thanks. ...
1
by: Tim | last post by:
Could anyone tell me what this means and how do I correct it. Any suggestions? Thanks! Tim Richardson IT Developer and Consultant www.paladin3d.com Unable to serialize the session state. In...
2
by: John Smith | last post by:
I'm writing webervice client using .Net 2.0. I have this class: public class MyWebService : SoapHttpClientProtocol { public XmlDocument validate(string url, XmlDocument xmlDocument) {...
6
by: tshad | last post by:
I had asked about this before, but have been unable to solve the problem. Could this be a problem with Web Services? I have 4 web services that I reference in this object. There is only one...
0
by: Nachi | last post by:
I have installed SQL Server 2000 with VS 2005 - did not install SqlExpress\Sql 2005. I have a remote Sql Server Instance locally. The normal application connectes to this Sql Server. When I run...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...
0
agi2029
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 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.