Click here to Skip to main content
15,888,113 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionSmart Card Pin
Mohd Atiq3-Feb-09 1:38
Mohd Atiq3-Feb-09 1:38 
AnswerRe: Smart Card Pin
annathor5-Feb-09 1:52
annathor5-Feb-09 1:52 
Questionbook Pin
welcan3-Feb-09 1:02
welcan3-Feb-09 1:02 
AnswerRe: book Pin
EliottA3-Feb-09 7:10
EliottA3-Feb-09 7:10 
AnswerRe: book Pin
vaghelabhavesh3-Feb-09 8:38
vaghelabhavesh3-Feb-09 8:38 
QuestionOracle Transactions Handling in ASP .NET Pin
summon_192-Feb-09 23:04
summon_192-Feb-09 23:04 
AnswerRe: Oracle Transactions Handling in ASP .NET Pin
Wendelius3-Feb-09 7:54
mentorWendelius3-Feb-09 7:54 
QuestionSerialization of List<> and Remoting [modified] Pin
Andez20042-Feb-09 22:00
Andez20042-Feb-09 22:00 
All,

I am having a bit of a headache with serialization of a custom class when using remoting. I am sure the problem is when remoting serializes a List<> of any type.

I was following the article by Marcel Heeremans - http://www.codeproject.com/KB/IP/TwoWayRemoting.aspx[^]

I managed to convert the program into a VB.NET service that communicates with a client exe. However, I wanted to create a custom type to enable messaging to a client.

I created my custom class that would be passed to a client via callback. This class is MessagePrompt (see below). I have changed my list type to String for this post as this fails as well as having any list type.

When the object is passed from server to client via callback, it fails. No exceptions are raised. However, from the tracing, I can see the object get successfully serialized at runtime. However, the client does not receive the object in the callback.

If I comment the following line, the the client does receive the object in the callback:

info.AddValue("Actions", _actions, GetType(List(Of String)))

If I manually serialize and deserialize the object then with XmlSerializer and StringWriter/StringReader, then it would appear to work fine in the client application.

Are there any issues as to why this would fail?
My assemblies are not strongly names as this causes the client callback to not work from the off. Therefore nothing is installed in the GAC.
Am I missing something?
Any pointers as to what I need to look at?
I can change the type to an ArrayList which would work but ideally I want to have a typed list.

Cheers for any help,

Paul



Here is my class:


<Serializable()> _
Public Class MessagePrompt

Implements ISerializable

Public _name As String

' this is the problem...
Public _actions As List(Of String)

Public Sub New()
End Sub


Public Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext)

Try

Trace.WriteLine("MessagePrompt.New: Deserializing")

_actions = CType(info.GetValue("Actions", GetType(List(Of String))), List(Of String))

Trace.WriteLine("MessagePrompt.New: There are " & _actions.Count & " actions")

Catch ex As Exception

Trace.WriteLine("MessagePrompt.New: Exception encountered deserializing.")
Trace.WriteLine(ex.ToString())

End Try

End Sub

Public Sub GetObjectData(ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext) Implements System.Runtime.Serialization.ISerializable.GetObjectData

Trace.WriteLine("MessagePrompt.GetObjectData: Serializing")

' comment this line and all works fine!!!!!! except that
' the values I need will not come across the wire unless I use
' array list.
info.AddValue("Actions", _actions, GetType(List(Of String)))

End Sub

End Class

modified on Tuesday, February 3, 2009 5:46 AM

QuestionCAS policy how to assign to a specific app Pin
Dan Neely2-Feb-09 8:00
Dan Neely2-Feb-09 8:00 
AnswerRe: CAS policy how to assign to a specific app Pin
Jon Rista3-Feb-09 10:08
Jon Rista3-Feb-09 10:08 
GeneralRe: CAS policy how to assign to a specific app Pin
Dan Neely3-Feb-09 10:21
Dan Neely3-Feb-09 10:21 
QuestionN-Hypernet in .net Pin
kamakshim2-Feb-09 2:59
kamakshim2-Feb-09 2:59 
AnswerRe: N-Hypernet in .net Pin
Colin Angus Mackay2-Feb-09 3:15
Colin Angus Mackay2-Feb-09 3:15 
GeneralRe: N-Hypernet in .net Pin
Mark Churchill2-Feb-09 13:30
Mark Churchill2-Feb-09 13:30 
AnswerRe: N-Hypernet in .net Pin
Pete O'Hanlon2-Feb-09 3:16
mvePete O'Hanlon2-Feb-09 3:16 
GeneralRe: NHibernate in .net Pin
kamakshim2-Feb-09 3:27
kamakshim2-Feb-09 3:27 
GeneralRe: NHibernate in .net Pin
Pete O'Hanlon2-Feb-09 3:36
mvePete O'Hanlon2-Feb-09 3:36 
Question"Configuration system failed to initialize" exception when upgradint to Visual Studio 2008 Pin
royk1231-Feb-09 23:39
royk1231-Feb-09 23:39 
QuestionFiltering a Datagridview with an external Combo Box Pin
Kumungi1-Feb-09 18:44
Kumungi1-Feb-09 18:44 
AnswerRe: Filtering a Datagridview with an external Combo Box Pin
Wendelius2-Feb-09 6:54
mentorWendelius2-Feb-09 6:54 
GeneralRe: Filtering a Datagridview with an external Combo Box Pin
Kumungi2-Feb-09 17:17
Kumungi2-Feb-09 17:17 
GeneralRe: Filtering a Datagridview with an external Combo Box Pin
Kumungi3-Feb-09 1:44
Kumungi3-Feb-09 1:44 
GeneralRe: Filtering a Datagridview with an external Combo Box Pin
Wendelius3-Feb-09 7:01
mentorWendelius3-Feb-09 7:01 
Questionset up project Pin
hrishiS31-Jan-09 2:10
hrishiS31-Jan-09 2:10 
Question[Message Deleted] Pin
svt gdwl30-Jan-09 23:11
svt gdwl30-Jan-09 23:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.