Thread View: microsoft.public.dotnet.framework.interop
4 messages
4 total messages
Started by Jeroen ter Hofstede
Thu, 16 Mar 2006 15:09
C# XslCompiledTransform crash when called from VCL C++
Author: Jeroen ter Hofstede
Date: Thu, 16 Mar 2006 15:09
Date: Thu, 16 Mar 2006 15:09
73 lines
3297 bytes
3297 bytes
Environment:
- .Net Framework v2.0.50727
- Borland C++ Builder 5
We are extending our C++ application with functionality in a C# dll.
The C++ app creates an object from the (registered) dll and calls a
method in it. This method creates and uses an XslCompiledTransform
object. Unfortunately, when calling Load() on this object, the
application crashes with an access violation in the .Net runtime. This
problem does not occur when we call the same method from a VB
application, nor does it occur when performing the same steps from
within a (C++ Builder) console application. Until now, we've only
managed to reproduce the problem from within a windowed (VCL)
application.
Does someone have any clue about what might cause this problem, and
moreover, what can be done about it?
TIA,
Jeroen
The smallest example that exhibits the problem contains:
* The C# file issue.cs (compile with csc /target:library issue.cs, and
then register it with regasm /codebase issue.dll)
---
using System.Runtime.InteropServices;
using System.Xml.Xsl;
[Guid("694C1820-04B6-4988-928F-FD858B95C880")]
public interface IIssue
{
void issue ();
}
[Guid("9E5E5FB2-219D-4ee7-AB27-E4DBED8E123E"),
ClassInterface(ClassInterfaceType.None)]
public class Issue : IIssue
{
public void issue ()
{
XslCompiledTransform transformer = new XslCompiledTransform ();
transformer.Load (@"c:\transform.xsl");
}
}
---
* The xsl file c:\transform.xsl:
---
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
</xsl:template>
</xsl:stylesheet>
---
and
* The C++ Builder program (project2.cpp in project2)
---
# include <olectnrs.hpp>
USERES("Project2.res");
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
OleInitialize (0);
Variant obj = CreateOleObject ("Issue");
obj.OleFunction ("issue");
return 0;
// Cut away the from creation and message
//loop - not needed for example
}
---
Re: C# XslCompiledTransform crash when called from VCL C++
Author: Jeroen ter Hofstede
Date: Fri, 17 Mar 2006 09:34
Date: Fri, 17 Mar 2006 09:34
14 lines
1898 bytes
1898 bytes
Jeroen ter Hofstede schreef: [snip] > object. Unfortunately, when calling Load() on this object, the > application crashes with an access violation in the .Net runtime. This [snip] After some experimentation and debugging: - The access violation seems to be caused by a stack overflow. I suspect that this is a symptom of the problem, not the cause. Increasing the stack from 1 to 4 MB does not help. - The problem also occurs when calling over the COM interface directly, bypassing OLE/IDispatch.
Re: C# XslCompiledTransform crash when called from VCL C++
Author: Jeroen ter Hofstede
Date: Fri, 17 Mar 2006 10:31
Date: Fri, 17 Mar 2006 10:31
19 lines
2068 bytes
2068 bytes
Jeroen ter Hofstede schreef: > Jeroen ter Hofstede schreef: > > [snip] > > object. Unfortunately, when calling Load() on this object, the > > application crashes with an access violation in the .Net runtime. This > [snip] > > > After some experimentation and debugging: > - The access violation seems to be caused by a stack overflow. I > suspect that this is a symptom of the problem, not the cause. > Increasing the stack from 1 to 4 MB does not help. I can confirm that now. The stack overflow is caused by an attempt to recursively handle a 'invalid floating point operation' fault in mscorjit.dll.
Re: C# XslCompiledTransform crash when called from VCL C++
Author: Jeroen ter Hofstede
Date: Fri, 17 Mar 2006 13:36
Date: Fri, 17 Mar 2006 13:36
25 lines
2459 bytes
2459 bytes
Jeroen ter Hofstede schreef: > Jeroen ter Hofstede schreef: > > > Jeroen ter Hofstede schreef: > > > > [snip] > > > object. Unfortunately, when calling Load() on this object, the > > > application crashes with an access violation in the .Net runtime. This > > [snip] > > > > > > After some experimentation and debugging: > > - The access violation seems to be caused by a stack overflow. I > > suspect that this is a symptom of the problem, not the cause. > > Increasing the stack from 1 to 4 MB does not help. > > I can confirm that now. The stack overflow is caused by an attempt to > recursively handle a 'invalid floating point operation' fault in > mscorjit.dll. A final update (and then I'll stop muttering to myself): the problem reproduces with the newest Borland C++ (Studio?). I can now reliable reproduce it also with a console application. The same program compiled with Visual C++ (2005) does not exhibit the problem.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads