473,382 Members | 1,424 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

COM Interop is causing a horrible CLR crash

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.ReleaseComO bject(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
Nov 16 '05 #1
2 2347
On 22 Jun 2004 02:37, "andrew lowe" wrote:
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:

<snip>

Have you tried using a StringBuilder as the out param rather than a string?
I recall seeing some stuff about doing that somewhere.....

--
Simon Smith
simon dot s at ghytred dot com
http://www.ghytred.com/NewsLook - Usenet for Outlook
Nov 16 '05 #2
On Tue, 22 Jun 2004 11:37:00 +1000, "andrew lowe" <andrew [dot] lowe
[at] geac [.] com> wrote:
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:


Hi andrew:

You might try this tool to see if it gives you any useful information:
CLRSPY -
http://www.gotdotnet.com/Community/U...5-ad09ef3bb37f

HTH,

--
Scott
http://www.OdeToCode.com
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Trokey | last post by:
I am making interop calls to an object in a .NET component from a C++ program and am leaking memory... the following is some sample code: //////////////////////////////////////// // .NET...
1
by: bugman | last post by:
The problem started with Firefox. Got to www.foxnews.com and click on any of the scrolling headlines in the right hand box. Firefox would crash. Now Opera and IE do also. If I disable...
7
by: Jamma | last post by:
Hello, I have an Access 2000 file working on XP machines and a NT network. The files are split and 95% of the time all is well and stable. The main issue arises when the app prints,a novell...
4
by: J-T | last post by:
I'm trying to read an excell file in my .Net application using Office XP Primary Interop Assemblies (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_oxppias.asp)....
3
by: Brad | last post by:
I have an aspx web page which initially displays fine. When I postback the resulting response back to the client output is causing InternetExplorer 6 to crash. I've disabled the server side code...
4
by: Technics | last post by:
Ok I will be as clearer as I can (sorry for english/technical mistakes) I would like to write an audio application that supports ASIO drivers. I downloaded the ASIO sdk from Stainberg and I read...
0
by: Udi | last post by:
Hi all, I'm having difficulties returning a buffer allocated on a callback called from a native dll to .NET assembly. (See pseudo code below in "Foo" func): The managed assembly (the called back...
2
by: RodneyAnonymous | last post by:
I've got some code for composing an e-mail from the contents of an RTF box. The first time I execute it, everything works fine. If I close my app and then re-run it, however, I always receive the...
5
by: q3537wh | last post by:
Has anyone encountered a situation where the @import is causing IE 6 to crash? I have a css file, let's call it test.css, that has only two lines in it. @import url("file1.css"); @import...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.