Skip to content

Allow End or GUI stop button when debugging TimerProcs #1

@Greedquest

Description

@Greedquest

Right now, there is a known limitation that Ending code execution of a TimerProc (through the debugger + Stop button, or the End keyword) will crash Excel. This is because stopping the TimerProc from returning means WinAPI never gets a response from Excel, and there is no way of catching the Error with VBA code as End destroys everything.

Now RubberDuck uses a clever method of invoking methods in their test explorer which circumvents this issue

https://github.com/rubberduck-vba/Rubberduck/blob/e498d9501935428f1a4918b228429c273e56687f/Rubberduck.VBEEditor/ComManagement/TypeLibs/TypeInfoVBEExtensions.cs#L141

However this cannot be implemented directly in VBA since even if the method of invoking catches End statements, there needs to be some code to handle that caught error, and if it's VBA then it will be destroyed - https://chat.stackexchange.com/transcript/message/54875311#54875311

There are 3 solutions I can think of:

  1. Use the RD method of invocation, but write some assembler to convert from WinAPI timer procs and whatever signature the invocation requires, and this way VBA is avoided entirely

  2. Create an addin in C# or VB6 perhaps which does what RD does natively and is unaffected by the code termination

  3. Write the error handling stuff in native assembler and forward the function call through that

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions