469,599 Members | 2,690 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,599 developers. It's quick & easy.

Unable to cast object of type System.__ComObject

In a Distributed Windows application, I receive the following message when
the client calls the server:

************** Exception Text **************
System.InvalidCastException: Unable to cast object of type
System.__ComObject to type System.Data.DataSet.

Server stack trace:
at servidor.IclaseSvr.prueba2(DataSet ds)
System.Runtime.Remoting.Messaging.StackBuilderSink .PrivateProcessMessage(MethodBase
mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext,
Object[]& outArgs)
System.Runtime.Remoting.Messaging.StackBuilderSink .SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleRe turnMessage(IMessage
reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateI nvoke(MessageData&
msgData, Int32 type)
at servidor.claseSvr.prueba2(DataSet ds)
at cliente.frmPrincipal.Button1_Click(Object sender, EventArgs e) in
d:\My Documents\Visual Studio
Projects\ErrorComObject\cliente\frmPrincipal.vb:li ne 113
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

However, if the Application COM's identity is the same that the client's
user ID, all works fine.

My server code is:

<SecureMethod()> _
Public Class claseSvr
Inherits ServicedComponent
Implements IclaseSvr

Public Sub prueba2(ByVal ds As DataSet) _
Implements IclaseSvr.prueba2
'<My Code Here>
End Sub

End Class

Public Interface IclaseSvr
Sub prueba2(ByVal ds As DataSet)
End Interface
My Client code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim svr As New servidor.claseSvr
Dim ds As DataSet

ds = New DataSet
'<some code>
End Sub
Some guess?


Fidias Gil de Montes

Sep 16 '05 #1
0 5258

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Pankaj Jain | last post: by
6 posts views Thread by Catherine Jones | last post: by
reply views Thread by Fidias Gil de Montes | last post: by
reply views Thread by hlyall1189 | last post: by
1 post views Thread by =?Utf-8?B?RGF2ZQ==?= | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.