在我的 Windows 应用程序中,我使用了一个用 .NET DLL 包装的 c++ DLL(特别是 quickfix 引擎)。运行时,每天一次(不是在任何特定时间),在其中一个内置类的构造函数中抛出运行时错误。即使错误被捕获并报告(到日志文件和数据库),我仍然得到 Windows 的“运行时错误”对话框(不提供恢复/调试选项)并且在按下“确定”按钮后(唯一的一个可用)我的应用程序已终止。
当在 Debug、Release 中运行时,甚至在 VS2005 调试器本身中运行时,都会发生这种情况。
作为旁注,我已经在本地编译了上述 DLL(因为其中至少有一个包括基于 XML 规范的自动生成的代码)。
任何人?(详情如下)
我的代码:
try
{
QuickFix.Symbol Symbol = new QuickFix.Symbol();
report.get(Symbol);
PairsType instrument = ToPairType(Symbol.getValue());
if (PairsType.NONE == instrument)
return;
QuickFix.MDEntryDate entryDate = new MDEntryDate();
QuickFix.MDEntryTime entryTime = new MDEntryTime();
QuickFix.QuoteCondition quoteCondition = new QuoteCondition();
QuickFix.MDEntryPx MDEntryPxBid = new QuickFix.MDEntryPx();
QuickFix.MDEntryPx MDEntryPxAsk = new QuickFix.MDEntryPx();
QuickFix.NoMDEntries noMDEntries = new QuickFix.NoMDEntries();
report.get(noMDEntries);
for (uint i = 1; i <= noMDEntries.getValue(); ++i)
{
QuickFix44.MarketDataSnapshotFullRefresh.NoMDEntries group =
new QuickFix44.MarketDataSnapshotFullRefresh.NoMDEntries();
report.getGroup(i, group);
if (group.isSetQuoteCondition())
group.get(quoteCondition);
if (group.isSetMDEntryDate())
group.get(entryDate);
if (group.isSetMDEntryTime())
group.get(entryTime);
switch (group.getMDEntryType().getValue())
{
case MDEntryType.BID:
group.get(MDEntryPxBid);
break;
case MDEntryType.OFFER:
group.get(MDEntryPxAsk);
break;
}
}
// use data...
}
catch (Exception e)
{
// log the error
}
错误详细信息:消息:外部组件已引发异常堆栈跟踪:
at FIX.message_order.=(message_order* , message_order* )
at std._Tree_nod<std::_Tmap_traits<int,FIX::FieldBase,FIX::message_order,std::allocator<std::pair<int const ,FIX::FieldBase> >,1> >.{ctor}(_Tree_nod<std::_Tmap_traits<int\,FIX::FieldBase\,FIX::message_order\,std::allocator<std::pair<int const \,FIX::FieldBase> >\,1> >* , message_order* _Parg, allocator<std::pair<int const \,FIX::FieldBase> >* _Al)
at std._Tree<std::_Tmap_traits<int,FIX::FieldBase,FIX::message_order,std::allocator<std::pair<int const ,FIX::FieldBase> >,1> >.{ctor}(_Tree<std::_Tmap_traits<int\,FIX::FieldBase\,FIX::message_order\,std::allocator<std::pair<int const \,FIX::FieldBase> >\,1> >* , message_order* _Parg, allocator<std::pair<int const \,FIX::FieldBase> >* _Al)
at FIX.FieldMap.{ctor}(FieldMap* , Int32* order)
at QuickFix.Group..ctor(Int32 field, Int32 delim, Int32[] message_order)
at QuickFix44.MarketDataSnapshotFullRefresh.NoMDEntries..ctor()
at PriceProviders.PriceProvider.onMarketDataRefresh(FixSession session, MarketDataSnapshotFullRefresh report)