Click here to Skip to main content
15,896,526 members
Home / Discussions / C#
   

C#

 
GeneralToolbox control like in VS Pin
Gareth H5-Apr-08 7:50
Gareth H5-Apr-08 7:50 
GeneralC# and Win32_PhysicalMedia SerialNumber from HDD Pin
novadon5-Apr-08 7:02
novadon5-Apr-08 7:02 
GeneralRe: C# and Win32_PhysicalMedia SerialNumber from HDD Pin
Luc Pattyn5-Apr-08 7:42
sitebuilderLuc Pattyn5-Apr-08 7:42 
Generalreading Windows settings (dcom) Pin
Schimaera5-Apr-08 6:33
Schimaera5-Apr-08 6:33 
QuestionHow to test connectivity to a UDP port on a remote system Pin
darthBug5-Apr-08 6:28
darthBug5-Apr-08 6:28 
GeneralRe: How to test connectivity to a UDP port on a remote system Pin
mav.northwind5-Apr-08 8:07
mav.northwind5-Apr-08 8:07 
GeneralRe: How to test connectivity to a UDP port on a remote system Pin
darthBug5-Apr-08 8:57
darthBug5-Apr-08 8:57 
General.NET remoting exception Pin
swati245-Apr-08 4:33
swati245-Apr-08 4:33 
Hi everyone,

I am writing a server-client chat application where I have a ServerObject that is subclassed from MarshalByRefObject and is created as a Singleton. This ServerObject is acquired by the client by the GetActivator() method. Now, I wanted to add an event handler that will be raised when someone joins or leaves the chat room. So, I have done something like this-

<br />
public delegate void OnUsersJoinEventHandler(object sender, EventArgs e);<br />
public delegate void OnUsersLeaveEventHandler(object sender, EventArgs e);<br />
<br />
public class ChatServerObject : MarshalByRefObject<br />
{<br />
    public event OnUsersJoinEventHandler UsersJoin;<br />
    public event OnUsersLeaveEventHandler UsersLeave;<br />
<br />
    protected virtual void OnUsersJoin(EventArgs e)<br />
    {<br />
      ...<br />
    }<br />
<br />
    protected virtual void OnUsersLeave(EventArgs e)<br />
    {<br />
      ...<br />
    }<br />
}<br />
<br />
public class ChatClient<br />
{<br />
    public ChatClient()<br />
    {<br />
        object server_obj = Activator.GetObject(typeof(ChatServerObject), "tcp://...");<br />
        m_chat_server_object = (ChatServerObject)server_obj;<br />
<br />
        m_chat_server_object.UsersLeave += new ChatServerObject(this.UsersLeft);....Line(1)<br />
    }<br />
}<br />


So, you get the idea. Now, when the code compiles okay but when the runtime executes the line (1) above it throws an exception. The exception says the following-
An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll. Getting the InnerException wasn't much insightful either. I can send you the full string of the InnerException if you think it might be useful. I tried to create another class that was subclassed from MarshalByRefObject but wasn't Registered as WKO; and that works fine. So, perhaps it has something to do with the fact that my server object is a WKO. Any insights into this problem will be useful.
GeneralRe: .NET remoting exception Pin
CodingYoshi5-Apr-08 7:31
CodingYoshi5-Apr-08 7:31 
GeneralRe: .NET remoting exception Pin
mav.northwind5-Apr-08 8:12
mav.northwind5-Apr-08 8:12 
QuestionHow to open a form in tableLayoutPanel control while loading? Pin
S a n d y5-Apr-08 2:34
S a n d y5-Apr-08 2:34 
GeneralAdministrate Indexing Server via Web App Pin
Muhammad Nauman Yousuf5-Apr-08 0:56
Muhammad Nauman Yousuf5-Apr-08 0:56 
GeneralBlocking certain website Pin
the pink jedi4-Apr-08 19:57
the pink jedi4-Apr-08 19:57 
GeneralRe: Blocking certain website Pin
Thomas Stockwell5-Apr-08 14:22
professionalThomas Stockwell5-Apr-08 14:22 
Generali need ole total collection and data type Pin
badshah20054-Apr-08 11:57
badshah20054-Apr-08 11:57 
GeneralRe: i need ole total collection and data type Pin
Rick van Woudenberg4-Apr-08 12:12
Rick van Woudenberg4-Apr-08 12:12 
Generalcompare byte array Pin
baranils4-Apr-08 11:37
baranils4-Apr-08 11:37 
GeneralRe: compare byte array Pin
MidwestLimey4-Apr-08 11:55
professionalMidwestLimey4-Apr-08 11:55 
GeneralRe: compare byte array Pin
Rick van Woudenberg4-Apr-08 11:55
Rick van Woudenberg4-Apr-08 11:55 
GeneralRe: compare byte array Pin
baranils4-Apr-08 19:42
baranils4-Apr-08 19:42 
GeneralBinaryRreader The string is prefixed with the length, encoded as an integer seven bits at a time Pin
baranils4-Apr-08 10:18
baranils4-Apr-08 10:18 
GeneralRe: BinaryRreader The string is prefixed with the length, encoded as an integer seven bits at a time Pin
KaptinKrunch4-Apr-08 10:31
KaptinKrunch4-Apr-08 10:31 
GeneralRe: BinaryRreader The string is prefixed with the length, encoded as an integer seven bits at a time Pin
baranils4-Apr-08 10:50
baranils4-Apr-08 10:50 
GeneralRe: BinaryRreader The string is prefixed with the length, encoded as an integer seven bits at a time Pin
Zoltan Balazs4-Apr-08 11:16
Zoltan Balazs4-Apr-08 11:16 
GeneralRe: BinaryRreader The string is prefixed with the length, encoded as an integer seven bits at a time Pin
baranils4-Apr-08 11:35
baranils4-Apr-08 11:35 

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.