Issue with console when executing C# code in Visual Studio

Spooky

When executing any code in the Visual Studio console, if there is an error in my code instead of displaying an error message it simply displays the most recent correct output, even if the code for it has been deleted, is there a setting that I accidentally turned on that is doing this? If so, how can I disable it?

I am using Visual Studio 2019, C#, console app. I have tried saving the new code then running it but that doesn't make a difference, I've tried quiting out of the app and reopening it or switching to a new project and that doesn't work either.

If I were to type:

Console.WriteLine("Hello world!");

Console.ReadLine();

which is correct code, it will display: Hello world!

If I then were to change it to:

Console.WriteLine("Goodbye world")

Console.ReadLine()

Instead of giving me an error message, since I forgot the semicolons, it would just print: Hello world! again.

I would expect there to be an error message instead of what happens since the previous program I used did that.

Ps: Sorry if this question is obvious or self explanatory or if it's just me who is wrong but it's really stressing me out seeing correct output from the wrong code.

Dmytro

I believe you're looking for Tools->Options->Projects and Solutions->Build And Run.

The default (which fails build on error) is what you see on screen (On Run, when build or deployment errors occur part):

enter image description here

The one that you're using now and trying to get rid of, most likely, is "Launch old version".

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Visual Studio Code for C# Console Application

Dart/Flutter Debug Console Issue on Visual Studio Code

Chrome crashed when using visual studio code debug console

How to create a C console application in Visual Studio Code

Visual Studio Code - Python debugging - Step into the code of external functions when executing

Visual Studio Code with GitHub Issue

Visual Studio Code theme issue

Errors executing Visual Studio Code in 14.04

How do i turn on or off the Visual Studio python (Jupyter) interactive window (2019) when executing code?

Executing shellcode in C (visual studio 2017

C in Visual Studio 2013, why is previously executed code which is now in comment still executing?

Error when executing code in android studio

Visual Studio Code Java JUnit Not Outputting to Console

PyCharm-like console in Visual Code Studio

Changing console app icon (visual studio code)

Visual Studio Code Debug Console colors?

Visual Studio Code replaces console.log()

How to use the console code in the .NET in visual studio

No output when executing stored procedure from mySQL in Visual Studio C#

Visual Studio Code issue with displaying message boxes

Font 'rendering' issue in Visual Studio Code

How to read input when debugging in C++ in Visual Studio Code?

How do I suppress the console window when debugging python code in Python Tools for Visual Studio (PTVS)?

Code stops executing when a user clicks on the console window

Visual Studio unable to use debugger (AccessViolationException). Code executing in random order

Why aren't my Visual Studio Code task executing?

Executing a T4 text template in Visual Studio Code

Why the code to write GUI application in c++ in Visual Studio is different than to console application?

SSIS Visual Studio Executing Different Packages when Clicking Start Button