DLL runtime error crashing my c # application - how to avoid this?

In my windows application, I use a C ++ DLL wrapped in a .NET DLL (in particular, a quick fix mechanism). During operation, once a day (not at any specific time), a runtime error occurs in one of the constructors of one of the built-in classes. Despite the fact that an error was detected and sent (to the log file and to the database), I still get the "Runtime Error" dialog box (which does not offer any recovery / debugging options) and after clicking the "ok" button (only one is available) my application is completed.

This happens when running in Debug, Release, and even while working in the VS2005 debugger itself.

As a note, I compiled the above DLLs locally (since at least one of them includes automatically generated code based on the XML specification).

Is anyone (see details)

My code is:

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 } 

Error Details: Message: External component throws stack trace exception:

 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) 
+2
source share
2 answers

You can download the QuickFix library to a separate AppDomain. This will protect your application from unexpected interruption.

You can verify that the application domain terminates from your main program and reloads it when required.

application domain

http://msdn.microsoft.com/en-us/library/system.appdomain.aspx

A little more information about creating an application using them

http://msdn.microsoft.com/en-us/library/yk22e11a(VS.71).aspx

I assume that you do not have access to the C ++ code, but. Ick .. what an unpleasant "stucco" fix.

0
source

It looks like you have a stack trace indicating an error inside the DLL.
Do you have a code? Is anyone supported who can forward the stack trace?

Without fixing the DLL itself, the problem will continue if you do not identify cases in your code that cause crashes and work around them, and not the recommended solution, but once the only one available when you do not control the code.

0
source

All Articles