1

I am experiencing the most peculiar thing. The InputBox from Microsoft.VisualBasic is broken and does not seem to work at all on my Windows 10 machine. No matter what I try it will not show up.

When I compile the following code and run it on my system, nothing happens and the program just seems idle but does not quit.

using Microsoft.VisualBasic;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            Interaction.InputBox("Prompt", "Title", "Default", -1, -1);
        }
    }
}

It does not throw any type of exception. Code after the InputBox does not run because the InputBox is synchronous. It seems as if the dialogue is simply not rendered visible.

Navigating using ALT+TAB there is no InputBox anywhere either.

It works fine on every other Windows system. When I copy the executable to one of my servers it behaves like expected.

I tried changing the target .NET framework version without any success. The InputBox.exe from https://www.robvanderwoude.com/dialogboxes.php#InputBox does not work either. It doesn't matter if I use C# or VB, neither work.

What am I not seeing?

EDIT

Apparently it takes about 20 (!) seconds for the InputBox to show. I guess I never waited that long. This is still unacceptable though, why would it take that long? This is a fairly fast system, nothing else lags like that.

Jochem Stoel
  • 1,371
  • 1
  • 13
  • 23
  • Works on my W10 Pro x64. Can't reproduce. – djv Sep 09 '19 at 19:10
  • Does it work if you omit the `-1, -1`? Does it work from a WinForms application? Do you see the InputBox window using Spy++? (It will *not* be listed as related to the console window, you will need to find it by the "Title" and the "Default" in the textbox). – GSerg Sep 09 '19 at 19:12
  • 1
    Could it be appearing on a second monitor which is switched off? – Andrew Morton Sep 09 '19 at 20:07
  • In addition to what @AndrewMorton said, you would see it in the taskbar in this case. – djv Sep 09 '19 at 21:20
  • Does `Microsoft.VisualBasic.Interaction.MsgBox()` work? – djv Sep 09 '19 at 21:29
  • It is a bog-standard Form.ShowDialog() call under the hood. Except when you don't use the [STAThread] attribute on the main() entrypoint, then it gets more complicated because it has to create a thread to do it right. Something that never happens in a VB.NET app. So remove that complication. Next temporarily disable the installed anti-malware product. Next drag that machine to a 4th+ story window and let it slip, opening the window first is optional. – Hans Passant Sep 09 '19 at 21:52
  • What's your project type? – Hursey Sep 10 '19 at 05:38
  • I edited my post to mention that apparently for some reason it takes about 20 seconds for the InputBox to show. – Jochem Stoel Sep 10 '19 at 06:39
  • 1
    20 seconds is anti-malware getting far too excited about an executable file appearing from no-where. Replace with the OS-provided flavor, or remove completely since there is no point to it anymore these days. – Hans Passant Sep 10 '19 at 06:45
  • @HansPassant no anti malware installed and Windows security disabled. – Jochem Stoel Sep 10 '19 at 22:48

0 Answers0