Click here to Skip to main content
15,902,189 members
Home / Discussions / C#
   

C#

 
GeneralRe: Invoke xsd.exe thru code Pin
kubben18-Apr-07 2:54
kubben18-Apr-07 2:54 
QuestionApp config files Pin
eliea17-Apr-07 5:18
eliea17-Apr-07 5:18 
AnswerRe: App config files Pin
eliea17-Apr-07 5:19
eliea17-Apr-07 5:19 
QuestionCannot get data saved to my SQL dbase Pin
tvance92917-Apr-07 5:01
tvance92917-Apr-07 5:01 
AnswerRe: Cannot get data saved to my SQL dbase Pin
mdv11321-Apr-07 10:25
mdv11321-Apr-07 10:25 
QuestionCreating a console typewriter-like program Pin
sharpiesharpie17-Apr-07 5:01
sharpiesharpie17-Apr-07 5:01 
AnswerRe: Creating a console typewriter-like program Pin
girm17-Apr-07 5:23
girm17-Apr-07 5:23 
QuestionSerialization issues with .NET Remoting Pin
mmfranke17-Apr-07 4:16
mmfranke17-Apr-07 4:16 
Hi.

I'm new to .NET, and I'm writing a logging service that uses .NET remoting. The idea is that the service publishes an EventProcessor object that clients can access via .NET Remoting, passing it DiagnosticEvent objects for processing.

I've altered the main program for the service slightly so that I can run it more easily as a "regular" application during debugging. I have an assembly that contains the "diagnostics" classes that do the work, the service app itself, and a test client app that lets you create a DiagnosticEvent and "dispatch" it.

The problem is that I'm getting errors telling me that the DiagnosticEvent object which I'm passing to the remote object is "not marked for serialization" -- even though it is. When I try adding a function that takes a TestObject, expecting the same error, I then get an exception about "unable to load for deserialization."

I'm clearly missing something basic.

One more little hitch is that I've been wrestling with static initialization of the remote object. It's a singleton class, and it seems that I get messed up if the server application instantiates the class before remote applications get a chance to. But perhaps that's for another post.

Can someone help me clear up my serialization issues? Here's some of the code:

The object I'm passing to the remote object is declared as:
[Serializable]
public class DiagnosticEvent : ISimObject
{ . . . }

...and so is my TestObject:
[Serializable]
public class TestObject
{
public int m_Int;
public string m_String;
}

Here's the code where the remote object is served up:

private static TcpChannel Publish()
{
TcpChannel channel = null;

if (channel == null)
{
// Create an instance of a channel
channel = new TcpChannel(8080);
ChannelServices.RegisterChannel(channel, false);
}

// Register as an available service with the name GEDiag
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(GESim.Diagnostics.EventProcessor),
"GEDiag",
WellKnownObjectMode.Singleton);

return channel;
}

Here's the code where the client connects to the remote object:

private void ConnectToEventProcessor()
{
// Create a channel for communicating w/ a remote object
// Notice no port is specified -- because we're the client.
if (null == s_Channel)
{
s_Channel = new TcpChannel();
ChannelServices.RegisterChannel(s_Channel, false);
}

if (null == m_RemoteEventProcessor)
{
// Create an instance of the remote object
m_RemoteEventProcessor =
(EventProcessor)Activator.GetObject(
typeof(EventProcessor),
"tcp://T00472343:8080/GEDiag");
}
}

...and finally, the code where the remote object is exercised -- both with a TestObject and with the actual DiagnosticEvent object. Neither work, for different reasons:

TestObject testObject = new TestObject();
testObject.m_Int = 45;
testObject.m_String = "Testing 123...";

int i = m_RemoteEventProcessor.Test(testObject);

m_RemoteEventProcessor.EnqueueEvent(theEvent);

I'd be happy to send the solution (I've scultped it down to something minimal).

Thanks, in advance.

Just Mike
AnswerRe: Serialization issues with .NET Remoting Pin
Pete O'Hanlon17-Apr-07 4:52
mvePete O'Hanlon17-Apr-07 4:52 
GeneralRe: Serialization issues with .NET Remoting Pin
mmfranke17-Apr-07 5:12
mmfranke17-Apr-07 5:12 
GeneralRe: Serialization issues with .NET Remoting Pin
Pete O'Hanlon17-Apr-07 5:20
mvePete O'Hanlon17-Apr-07 5:20 
GeneralRe: Serialization issues with .NET Remoting Pin
mmfranke17-Apr-07 5:50
mmfranke17-Apr-07 5:50 
GeneralRe: Serialization issues with .NET Remoting Pin
Pete O'Hanlon17-Apr-07 9:52
mvePete O'Hanlon17-Apr-07 9:52 
GeneralRe: Serialization issues with .NET Remoting Pin
mmfranke17-Apr-07 9:55
mmfranke17-Apr-07 9:55 
QuestionC# Dynamically Named Array (Or arraylists) Pin
bugg_tb17-Apr-07 3:59
bugg_tb17-Apr-07 3:59 
AnswerRe: C# Dynamically Named Array (Or arraylists) Pin
Martin#17-Apr-07 4:39
Martin#17-Apr-07 4:39 
GeneralRe: C# Dynamically Named Array (Or arraylists) Pin
bugg_tb17-Apr-07 5:28
bugg_tb17-Apr-07 5:28 
GeneralRe: C# Dynamically Named Array (Or arraylists) Pin
Martin#17-Apr-07 5:32
Martin#17-Apr-07 5:32 
AnswerRe: C# Dynamically Named Array (Or arraylists) Pin
Vikram A Punathambekar17-Apr-07 4:47
Vikram A Punathambekar17-Apr-07 4:47 
QuestionUserControl and List Pin
Monty217-Apr-07 3:47
Monty217-Apr-07 3:47 
AnswerRe: UserControl and List Pin
sujithkumarsl17-Apr-07 20:06
sujithkumarsl17-Apr-07 20:06 
GeneralRe: UserControl and List Pin
Monty217-Apr-07 20:19
Monty217-Apr-07 20:19 
AnswerSolution for those who cares Pin
Monty217-Apr-07 23:18
Monty217-Apr-07 23:18 
Questionclick once Deployment help needed Pin
pashitech17-Apr-07 3:42
pashitech17-Apr-07 3:42 
QuestionDevExpress .NET controls [modified] Pin
Jerry Evans17-Apr-07 3:26
Jerry Evans17-Apr-07 3:26 

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.