I have a legacy delphi program and want to add some content implemented with WPF. So I encapsulate the WPF control with a .NET/ActiveX interop technology. That means something like:
[ComRegisterFunction()]
public static void RegisterClass(string key);
[ComUnregisterFunction()]
public static void UnregisterClass(string key);
The activeX component is a WinForms User Control and the WPF materials are attached to an ElemenHost in this User Control.
It works fine if the host app of this ActiveX is a MFC program even without /clr switch. But my legacy app is a delphi program, and it always throw a stackoverflow exception at the first line of the constructor of my WPF user control as the program be started.
the message shows by exception is:
An unhandled exception of type 'System.StackOverflowException' occurred in PresentationFramework.dll
I have no clue, Google is no help. and it has puzzled me for days.