A
Anders Eriksson
I have a COM Server, written in C++ by a third party, and on one
function I get an System.InvalidCastException
According to the documentation and the interop "table" it should return
a LaserObject, which is a special object for the Com Server.
Since I haven't yet gotten any response from the developers I thought I
ask here.
Is there someway I can get what return object the function actually returns?
This is the exception:
System.InvalidCastException was unhandled
Message=Return argument has an invalid type.
Source=mscorlib
StackTrace:
at
System.Runtime.Remoting.Proxies.RealProxy.ValidateReturnArg(Object arg,
Type paramType)
at
System.Runtime.Remoting.Proxies.RealProxy.PropagateOutParameters(IMessage msg,
Object[] outArgs, Object returnValue)
at System.RuntimeType.ForwardCallToInvokeMember(String
memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes,
MessageData& msgData)
at laserengineLib.LaserImportedClass.getObject(Int32 p_nIndex)
at LighterTest1.Form1.ImportButton_Click(Object sender,
EventArgs e) in C:\Users\ame\Documents\Visual Studio
2010\Projects\TEST\LighterTest1\LighterTest1\Form1.cs:line 83
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs 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.Control.ControlNativeWindow.OnMessage(Message& m)
at
System.Windows.Forms.Control.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.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32
reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at LighterTest1.Program.Main() in C:\Users\ame\Documents\Visual
Studio 2010\Projects\TEST\LighterTest1\LighterTest1\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly,
String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean
ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
// Anders
function I get an System.InvalidCastException
According to the documentation and the interop "table" it should return
a LaserObject, which is a special object for the Com Server.
Since I haven't yet gotten any response from the developers I thought I
ask here.
Is there someway I can get what return object the function actually returns?
This is the exception:
System.InvalidCastException was unhandled
Message=Return argument has an invalid type.
Source=mscorlib
StackTrace:
at
System.Runtime.Remoting.Proxies.RealProxy.ValidateReturnArg(Object arg,
Type paramType)
at
System.Runtime.Remoting.Proxies.RealProxy.PropagateOutParameters(IMessage msg,
Object[] outArgs, Object returnValue)
at System.RuntimeType.ForwardCallToInvokeMember(String
memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes,
MessageData& msgData)
at laserengineLib.LaserImportedClass.getObject(Int32 p_nIndex)
at LighterTest1.Form1.ImportButton_Click(Object sender,
EventArgs e) in C:\Users\ame\Documents\Visual Studio
2010\Projects\TEST\LighterTest1\LighterTest1\Form1.cs:line 83
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs 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.Control.ControlNativeWindow.OnMessage(Message& m)
at
System.Windows.Forms.Control.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.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32
reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at LighterTest1.Program.Main() in C:\Users\ame\Documents\Visual
Studio 2010\Projects\TEST\LighterTest1\LighterTest1\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly,
String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean
ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
// Anders