Groups | Blog | Home
all groups > dotnet remoting > july 2003 >

dotnet remoting : Problem returning array of COMTI structures from remoting server to client


mcinerneyed NO[at]SPAM russellcorp.com
7/22/2003 12:54:19 PM
Computer gods,

My direct problem is that I'm getting this error message back from my
remoting client, indicating the an error on the remoting server:

-----
System.Runtime.Remoting.RemotingException: Server encountered an
internal error. For more information, turn on customErrors in the
server's .config file.

Server stack trace:

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 DummyLibrary.Dummy.BOMXplosionAll(String& sRetCode, Int32&
lSQLCode, String& sRetMsg, String& sGarStyle, String& sGarColor,
String& sGarSize, Double& dblGarLbs, Array& aFILLER) in
c:\work\testapps\dotnet\edtestremoting\c#-http\debugbomxplosion\dummylibrary\dumdum.cs:line
237
at EdTestRemotingClient.frmMain.btnBOMXplosionALLViaRemoting_Click(Object
sender, EventArgs e) in
c:\work\testapps\dotnet\edtestremoting\c#-http\debugbomxplosion\edtestremotingclient\frmmain.cs:line
281
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.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)

-----

NOTE: This only happens on this specific method call...other remoting
calls work OK.

I'll try to keep this brief, but there's some necessary background to
my problem:
I'm using a COMTI component built and run on Host Integration Server
2000 to execute a COBOL program via CICS transaction.
The COBOL program has nested "Occurs" statements:

....
006310 05 FILLER OCCURS 10 TIMES.
006320 07 COM-RET-FIN-STYLE PIC X(7).
006330 07 COM-RET-FIN-COLOR PIC X(3).
006340 07 COM-RET-FIN-SIZE PIC X(2).
006350 07 COM-RET-FIN-LBS PIC 9(11)V9999 COMP-3.
006360 07 COM-RET-FIN-POU PIC X(3).
006370 07 COM-RET-GRE-CODE PIC X(15).
006380 07 COM-RET-GRE-LBS PIC 9(11)V9999 COMP-3.
006390 07 FILLER OCCURS 20 TIMES.
006400 09 COM-RET-YARN-CODE PIC X(15).
006410 09 COM-RET-YARN-LBS PIC 9(11)V9999 COMP-3.
....

In my COMTI component, I've selected to have the data from these
nested "Occurs" statements returned to me as "User-Defined
Types"...essentially,
they are returned as an array of structures with last item in the 1st
structure being a nested array of the inner structure.

I am instantiating and executing this COMTI component on the HIS
server through a C# .NET remoting server that I call from my local PC
and a
C# .NET remoting client. I am able to interrogate the resulting nested
array of structures on the server (using console.writelines and
itterating through the array). So, the problem is not connectivity
related. The problem (see the error message above) comes when I try
to pass back the array of structures to the remoting client as an
"out" parameter.

Again, the remoting configuration/functionality itself seems to work
OK, as I can execute other remote methods OK.
So, does anyone have an idea as to why this happens?

I've tried declaring the method several different ways (returning the
array as a system.array and as an array of the specific structure
-see the last out param)...

public string BOMXplosionAll(out string sRetCode, out Int32
lSQLCode, out string sRetMsg, out string sGarStyle,
out string sGarColor, out string sGarSize, out Double dblGarLbs,
out Array aFILLER)

public string BOMXplosionAll2(out string sRetCode, out Int32
lSQLCode, out string sRetMsg, out string sGarStyle,
out string sGarColor, out string sGarSize, out Double dblGarLbs,
out BOMXplosionAA.FILLER[] aReturnFILLER)

and they both get the same error message. If I do not pass back an
array (remove it from the out param), it works. So, then I tried just
creating a simple test method that returned an array...
public string Test(out string[] aTest)
and that DID work, so I don't think it's a problem with returning
arrays.

Any and All help is appreciated!

Thank you,

mcinerneyed NO[at]SPAM russellcorp.com
7/23/2003 7:02:20 AM
Update:

I THINK I figured out what the problem is...

The COMTI component returns an array of these user-defined types
(structures). The COMTI component is a .TLB that derives from the
COMTI runtime (tagen.dll)...an unmanaged COM component.
Arrays are non-blittable types (they are handled differently in
managed and unmanaged code). When I tried to marshal an array of the
COMTI UDTs/Structures created by unmanaged code from my remoting
server to my remoting client, I wasn't handling this properly and it
caused the very generic error "Server encountered an internal error".

I haven't figured out how to get this to work (it's still a bit over
my head), so we're going to try a workaround of packing the data (on
the server) into a dataset, XML, or our own .NET managed array of our
own structure and passing that back to the client instead.

For more information, see "Default Marshaling for Arrays" in MSDN.

-Ed

[quoted text, click to view]
Aaron Grady [MSFT]
8/7/2003 9:00:51 AM
Ed-

I haven't tried to repro your problem, but I've seen similar issues where a
UDT or array of UDTs caused an error when returning from COMTI to the .NET
Framework. To resolve these problems, you have to register the interop
assembly with the REGASM.exe utility.

See the following KB article:

811445.KB.EN-US Using COMTI User-Defined Types with .NET and Visual Studio
..NET
http://support.microsoft.com/default.aspx?scid=KB;EN-US;811445

If you still have trouble, you may want to open up a support case with us so
we can try and repro your problem and help you find a solution.

HTH,
--
Aaron Grady
MCSE + Internet, MCDBA, MCSA
SNA Server/Host Integration Server 2000 Support
Microsoft Ltd.

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


[quoted text, click to view]
c:\work\testapps\dotnet\edtestremoting\c#-http\debugbomxplosion\dummylibrary
\dumdum.cs:line
[quoted text, click to view]
c:\work\testapps\dotnet\edtestremoting\c#-http\debugbomxplosion\edtestremoti
ngclient\frmmain.cs:line
[quoted text, click to view]
AddThis Social Bookmark Button