0

SetUnhandledExceptionFilterカスタム例外ハンドラをインストールしていました。UnhandledException以下のコードでは、未処理の例外が発生した場合、メソッドが呼び出されて出力foo!されることを期待しています

namespace mcFastNative {

Receiver* incOrdersA;
IncFeed* incOrders;

Receiver* snpOrdersA;
SnapshotFeed* snpOrders;

    // not important methods are ommited

bool McFastNativeAdapter::Disconnect() {
    incOrdersA->Disconnect();
    return true;
}


LONG WINAPI UnhandledException(LPEXCEPTION_POINTERS ExceptionInfo)  
{  
    printf("foo!");
            return EXCEPTION_CONTINUE_SEARCH;
}

void McFastNativeAdapter::Initialize(unsigned long feedA_group, unsigned long feedA_source, int feedA_port,
    unsigned long historicalIp, int historicalPort,
    unsigned long snapshotGroup, unsigned long snapshotSource, int snapshotPort)
{
    // Init WinSock
    WSAData data;
    WSAStartup( MAKEWORD( 2, 2 ), &data );

    SetUnhandledExceptionFilter(UnhandledException);

    incOrdersA = new Receiver(feedA_group, feedA_source, feedA_port);
    snpOrdersA = new Receiver(snapshotGroup, snapshotSource, snapshotPort);

    incOrders = new IncFeed("IncFeed");
    incOrdersA->SetFeed(incOrders);

    snpOrders = new SnapshotFeed("SnapshotFeed");
    snpOrdersA->SetFeed(snpOrders);
}

}

しかし、私はそのような出力を受け取りました:

System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception. at mcFastNative.McFastNativeAdapter.Disconnect() at Fast.mcFastAdapterCpp.Disconnect() ...

foo!ただし、例外が発生したことがわかるように、コンソールには出力されませんでした。未処理の例外incOrdersA->Disconnect();がキャッチされfoo!ず、出力されなかったのはなぜですか?

4

0 に答える 0