System.Runtime.Remoting - Sending an Image through a TcpChannel 
Author Message
 System.Runtime.Remoting - Sending an Image through a TcpChannel

Can someone explain to me why this exception is thrown when I try to send an
Image through my TcpChannel:

--> Unhandled Exception: System.Runtime.Remoting.RemotingException: Remoting
cannot find field nativeImage on type System.Drawing.Image.

It works ok if I send the Image as a FileStream.

The overview of the Abstract Image class looks like this:

[C#]
[Serializable]
[ComVisible(true)]
public abstract class Image : MarshalByRefObject, ISerializable,
   ICloneable, IDisposable

With this description, why does'nt it work?

Plz help

Brian Bugge - Denmark



Mon, 09 May 2005 05:56:54 GMT  
 System.Runtime.Remoting - Sending an Image through a TcpChannel
This is a little confusing, you are passing a MarshalByRef object, but
getting a serialization exception, actually in the case below remoting will
always pass the object as MarsahlByRef, are you doing anything special?
could you attach the entire callstack for the exception?

JR

--
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.

This posting is provided \"AS IS\" with no warranties, and confers no
rights.


Quote:
> Can someone explain to me why this exception is thrown when I try to send
an
> Image through my TcpChannel:

> --> Unhandled Exception: System.Runtime.Remoting.RemotingException:
Remoting
> cannot find field nativeImage on type System.Drawing.Image.

> It works ok if I send the Image as a FileStream.

> The overview of the Abstract Image class looks like this:

> [C#]
> [Serializable]
> [ComVisible(true)]
> public abstract class Image : MarshalByRefObject, ISerializable,
>    ICloneable, IDisposable

> With this description, why does'nt it work?

> Plz help

> Brian Bugge - Denmark



Mon, 09 May 2005 10:37:30 GMT  
 System.Runtime.Remoting - Sending an Image through a TcpChannel
Okay I think I receive my object which is serialized, but inside this object
I have an Image.
The problem occurs when a trie to bind this image to a PictureBox, and here
is the message I get:

Unhandled Exception: System.Runtime.Remoting.RemotingException: Remoting
cannot find field nativeImage on type System.Drawing.Image.

Server stack trace:

   at System.Object.GetFieldInfo(String typeName, String fieldName)

   at System.Object.FieldGetter(String typeName, String fieldName, Object&
val)

   at
System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(Met
hodBase mb, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInContext, Object[]& outArgs)

   at
System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessa
ge msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]:

   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)

   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)

   at System.Object.FieldGetter(String typeName, String fieldName, Object&
val)

   at System.Drawing.Graphics.DrawImage(Image image, Int32 x, Int32 y, Int32
width, Int32 height)

   at System.Drawing.Graphics.DrawImage(Image image, Rectangle rect)

   at System.Windows.Forms.PictureBox.OnPaint(PaintEventArgs pe)

   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e,
Int16 layer, Boolean disposeEventArgs)

   at System.Windows.Forms.Control.WmPaint(Message& m)

   at System.Windows.Forms.Control.WndProc(Message& m)

   at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)

   at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)

   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)

   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)

   at
System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMetho
ds+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason,
Int32 pvLoopData)

   at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)

   at System.Windows.Forms.Application.Run(Form mainForm)

   at Client.Form1.Main() in
d:\.net\remoting\billedtest\client\form1.cs:line 110The program '[1824]
Client.exe' has exited with code 0 (0x0).

So the problem is to bind the image to the PictureBox, and not to
send/receive the Image, I guess :)



Quote:
> This is a little confusing, you are passing a MarshalByRef object, but
> getting a serialization exception, actually in the case below remoting
will
> always pass the object as MarsahlByRef, are you doing anything special?
> could you attach the entire callstack for the exception?

> JR



Mon, 09 May 2005 17:35:29 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. When to use System.Net and System.Runtime.Remoting

2. about the namespace System.Runtime.Remoting.Channels.Tcp

3. System.runtime.remoting.channels.http?

4. .NET Runtime.Remoting

5. System.Drawing.Image new image properties

6. How to use the System.Runtime.Remoting.Channels.Tcp namespace?

7. Change TcpChannel ChannelName

8. Loading images during runtime

9. Display Bitmap Image in Dialog at Runtime.

10. Loading an image into resource at runtime ?

11. Runtime creating images

12. Cannot find namspace for "TcpChannel()"

 

 
Powered by phpBB® Forum Software