Fake MsgBox crashes after setting return value for input box for all invocations #3720
Labels
bug
Identifies work items for known bugs
critical
Marks a bug as a must-fix, showstopper issue
feature-unit-testing
Milestone
I am currently testing code in Excel VBA that involves a MsgBox and an InputBox. So I used "Fakes.InputBox.ReturnsWhen..." and "Fakes.MsgBox.Returns" statements as I thought appropriate.
In some cases this (reproducibly) leads to crashes and I can quickly glimpse the error message "Test raised an error. Specified cast is not valid."
Here you can find a minimal example to reproduce the issue (new, empty Excel 2016 *xlsm Workbook):
Another version that leads to the same crash is:
'Fakes.InputBox.ReturnsWhen "Prompt", "Second", "User entry 2", 1
But this will not crash:
'Fakes.InputBox.ReturnsWhen "Prompt", "Second", "User entry 2", 2
Rubberduck version: Version 2.1.2.2738
Operating System: Microsoft Windows NT 10.0.14393.0, x64
Host Product: Microsoft Office 2016 x64
Host Version: 16.0.8431.2131
Host Executable: EXCEL.EXE
The text was updated successfully, but these errors were encountered: