StackOverflowException in mscorlib.dll, C# and Excel 2002

  • Thread starter Thread starter Elizabeth
  • Start date Start date
E

Elizabeth

I have C# dll which I compile using ComInterop True and generate tlb
type library. When I call function from the C# dll using below code I
get an error
"StackOverflowException in mscorlib.dll"

Excel vba code:

sub callwrapper()
dim oxml as object
dim sreturnxml as string, spassxmlstring as string

set oxml = new wrapper.clsname
sreturnxml = oxml.xmlfuncname(spassxmlstring)
print sreturnxml
end sub

function xmlfuncname from c# dll calls another native C++dll and returns
xml string which is large. This C#dll works if being called from C# gui.
but either hangs or gives stackOverflowException when called from
excel/vba gui.
return xml is string builder with buffer(50000) which I convert to
string using stringbuildervariable.ToString(0 and pass to excel gui.

Anyone has idea whats happening in excel? how do I handle large buffer
in excel? is that a buffer issue?
Please help.

Programming is fun!
 
Back
Top