我成功地将CLR2.0托管在Delphi应用程序中,该应用程序能够在Delphi控件中创建和宿主WPF控件,类似于win32应用程序的ElementHost。
现在,我想将我的解决方案移到CLR4.0上,一切正常,除非我尝试创建一个具有相关Xaml资源的UserControl。在这种情况下,它会导致堆栈溢出错误,迫使进程退出!但是,如果我通过代码创建一些WPF控件(没有读取xaml),那么一切都很好!
我成功地进入了框架代码,直到我进入XamlReader.LoadBaml方法,该方法在执行以下代码后崩溃:
// We don't actually use the GeneratedInternalTypeHelper any more.
// But for v3 compat, don't allow loading of internals in PT unless there is one.
Type internalTypeHelper = null;
if (streamInfo.Assembly != null)
{
try
{
internalTypeHelper = XamlTypeMapper.GetInternalTypeHelperTypeFromAssembly(parserContext);
}
// This can perform attribute reflection which will fail if the assembly has unresolvable
// attributes. If that happens, just assume there is no helper.
catch (Exception e)
{
if (MS.Internal.CriticalExceptions.IsCriticalException(e))
{
throw;
}
}
}注意,加载的程序集也使用CLR4。
谢谢你的帮忙,
摩根
发布于 2010-07-20 03:06:57
我发现了这个问题,这要归功于Stackoveflow上的另一篇文章(Hosting CLR in Delphi with/without JCL - example,参见重要注释)。
我不得不用Set8087CW($133 F)初始化fpu,然后奇怪的stackoverlow停止了!
不过,我仍然有一种奇怪的行为:没有任何调试器,一切都很好,但是如果我从VS2010运行这个应用程序,那么就会显示一个黑色的wpf表单,阻止我与内容交互。不过,如果我运行应用程序,然后附加调试器,那么一切都好!
https://stackoverflow.com/questions/3261824
复制相似问题