0

I am completely new to programming, just saying. Console.ReadKey(); is throwing an exception with the message 'System.InvalidOperationException'. I've been browsing in the site and didn't found this exact problem. How can I solve this?

Sidenote: I have .Net Core installed.

Here's a screenshot.

Image

IndieGameDev
  • 2,905
  • 3
  • 16
  • 29
  • It would be very helpful to include the full error message that's in the screenshot, but as text in the question. The text of the message makes it much clearer what's going on. – Jon Skeet Sep 30 '20 at 17:26

1 Answers1

0

You need to check if STDIN is redirected, use Console.IsInputRedirected (public static bool IsInputRedirected { get; })

Wasif
  • 14,755
  • 3
  • 14
  • 34