A
andrew lowe
Hi there,
We have to use a com interop library generated by tlbimp, where the orginal
com object is written in uniface (a compuware language). The method we use
and have the problem with has the following signature:
[PreserveSig, DispId(1002)]
int exec(
[In, MarshalAs(UnmanagedType.BStr)] string servicetorun,
[In, MarshalAs(UnmanagedType.BStr)] string inparameters,
[MarshalAs(UnmanagedType.BStr)] out string outparameters);
As you can see we have an output parameter that returns a string. Everything
works great when the output string is <= 700k. However once it becomes
around 800k & greater, we get a horrible error that cannot be caught. Here's
the code that produces the error:
using System;
namespace MarshallingTest {
public class Class1 {
[STAThread]
public static void Main(string[] args) {
ePathway.Request.Broker.esyv0005Class service = null;
try {
Console.WriteLine("Before create esyv0005");
service = new ePathway.Request.Broker.esyv0005Class();
Console.WriteLine("esyv0005 created");
string xml;
service.exec("esyv0095", "", out xml);
Console.WriteLine(xml);
} catch (Exception e) {
Console.WriteLine(e.ToString());
} finally {
if (service != null)
System.Runtime.InteropServices.Marshal.ReleaseComObject(service);
Console.WriteLine("Press a key to continue");
Console.ReadLine();
}
}
}
}
The error is:
MarshallingTest.exe - Common Language Runtime Debuggin services
Application has generated an error that can't be handled
Process Id=0x6f8(1784), Thread Id=0xc24(3108)
Any ideas on what might be going on here ?
tia
andrew
We have to use a com interop library generated by tlbimp, where the orginal
com object is written in uniface (a compuware language). The method we use
and have the problem with has the following signature:
[PreserveSig, DispId(1002)]
int exec(
[In, MarshalAs(UnmanagedType.BStr)] string servicetorun,
[In, MarshalAs(UnmanagedType.BStr)] string inparameters,
[MarshalAs(UnmanagedType.BStr)] out string outparameters);
As you can see we have an output parameter that returns a string. Everything
works great when the output string is <= 700k. However once it becomes
around 800k & greater, we get a horrible error that cannot be caught. Here's
the code that produces the error:
using System;
namespace MarshallingTest {
public class Class1 {
[STAThread]
public static void Main(string[] args) {
ePathway.Request.Broker.esyv0005Class service = null;
try {
Console.WriteLine("Before create esyv0005");
service = new ePathway.Request.Broker.esyv0005Class();
Console.WriteLine("esyv0005 created");
string xml;
service.exec("esyv0095", "", out xml);
Console.WriteLine(xml);
} catch (Exception e) {
Console.WriteLine(e.ToString());
} finally {
if (service != null)
System.Runtime.InteropServices.Marshal.ReleaseComObject(service);
Console.WriteLine("Press a key to continue");
Console.ReadLine();
}
}
}
}
The error is:
MarshallingTest.exe - Common Language Runtime Debuggin services
Application has generated an error that can't be handled
Process Id=0x6f8(1784), Thread Id=0xc24(3108)
Any ideas on what might be going on here ?
tia
andrew