public int Attach(IDebugProgram2[] programs, IDebugProgramNode2[] programNodes, uint celtPrograms, IDebugEventCallback2 ad7Callback, enum_ATTACH_REASON dwReason)
        {
            var integration = InitializationCallback();

            ErrorHandler.ThrowOnFailure(programs[0].GetProcess(out var process));
            _program   = programs[0] as Program;
            _callbacks = new EngineCallbacks(this, _program, process, ad7Callback);

            /* Since VS will add breakpoints right after OnAttach callback, we need to invoke Program.AttachDebugger first */
            _program.AttachDebugger(integration, _callbacks);
            _callbacks.OnAttach();

            return(VSConstants.S_OK);
        }
        public int ContinueFromSynchronousEvent(IDebugEvent2 eventObject)
        {
            switch (eventObject)
            {
            case AD7ProgramDestroyEvent _:
                _program   = null;
                _callbacks = null;
                TerminationCallback();
                break;

            case AD7LoadCompleteEvent _:
                _program.Continue(thread: null);
                break;
            }
            return(VSConstants.S_OK);
        }