βœ… User Input is glitching

So I have this code
Console.WriteLine("Hello");
option = Console.ReadLine();
Console.WriteLine("Hello");
option = Console.ReadLine();
When I run the program for the first time and I press Enter when it wants the user input I got this: Uploaded image Then I typed \ and it deleted the H from Hello I am doing something wrong? I use .NET 6.0 because it says it has long term support.
No description
No description
11 Replies
Pobiega
Pobiegaβ€’5mo ago
.NET 8 also has long term support, fyi
𝓻𝓸𝓸𝓽𝔂
When I added
Console.WriteLine("Hello");
option = Console.ReadLine();
Console.WriteLine("You entered: "+option);
Console.WriteLine("Hello");
option = Console.ReadLine();
Console.WriteLine("You entered: "+option);
I got
No description
Pobiega
Pobiegaβ€’5mo ago
terminal input can be finicky when typing weird stuff, like control characters etc, but other than that I can't see why it would do what you describe in the opening post
Angius
Angiusβ€’5mo ago
What terminal?
𝓻𝓸𝓸𝓽𝔂
Windows 10 I found it. Console.TreatControlCAsInput = true; this was in my code. somehow. I removed it and it works.
qqdev
qqdevβ€’5mo ago
Not sure why that would lead to the described behavior but okay :pepelaff: Did you press CTRL+C?
𝓻𝓸𝓸𝓽𝔂
same thing no I just pressed Enter.
qqdev
qqdevβ€’5mo ago
Weird
Xour
Xourβ€’5mo ago
Is there anything else in the code? This works: https://dotnetfiddle.net/R19fH5
qqdev
qqdevβ€’5mo ago
My first thought was that the terminal switched into the "overwrite/overtype mode"
Unknown User
Unknown Userβ€’5mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server