microsoft / krabsetw

KrabsETW provides a modern C++ wrapper and a .NET wrapper around the low-level ETW trace consumption functions.
Other
588 stars 147 forks source link

Send schema errors to OnError callback in all cases #175

Closed swannman closed 3 years ago

swannman commented 3 years ago

A schema lookup occurs when a predicate filter is applied to a record. If the schema lookup fails, a krabs::could_not_find_schema exception is thrown. This exception was previously unhandled and caused an exception to propagate on the main trace thread.

A better way to handle this is to catch the schema exception and notify the application via an OnError delegate. An OnError delegate existed on the C++/CLI Provider object but not on the native event_filter and provider objects nor on the C++/CLI EventFilter.

This change finishes the implementation of error handling on the managed and native layers:

swannman commented 3 years ago

Thanks @henriblMSFT for the review! Updated with your feedback.