Writing a Winforms application over .NET 4.0 (using VB2010). It has a single form, including an ActiveX COM control asynchronously raising events. The events are handled by hook functions on form’s code-file. Application does NOT start any threads (except the main one, ofcourse).
Should I guard from event-handler reentrancy?
Could Event B‘s hook-function be called while Event A‘s hook-function is being executed?
{ Searching the web has raised several conflicting answers. I’m puzzled here… }
It is not any different for ActiveX controls versus .NET controls. Whatever you do in the event A event handler that affects the control may certainly cause another event to be raised. Or event A may be raised again. Another event rarely causes trouble but the latter case usually causes this site’s name exception. And you fix it the same way, a bool field that prevents re-entry.
The underlying mechanics are identical. An ActiveX control too can fire an event in a property setter. That doesn’t have anything to do with threading or a single threaded apartment.