Debug

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/21

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 3:54 AM on 8/8/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

22 Terms

1
New cards

Debug

A static class in the System.Diagnostics namespace used to emit debugging information and check program logic with assertions. Its methods are primarily intended for debug builds. Domain: C# → .NET → System.Diagnostics → Debugging Output & Assertions

2
New cards

Debug.Write("Loading…");

Writes debugging information without automatically adding a new line.

3
New cards

Debug.WriteLine("Program started");

Writes debugging information followed by a line terminator.

4
New cards

Debug.WriteLine(value);

Writes the value of an object to the debug listeners by using the object's ToString() representation.

5
New cards

Debug.WriteLine("Connected", "Network");

Writes a debugging message together with a category name that can help identify the type or source of the message.

6
New cards

Debug.WriteIf(condition, "Value is invalid");

Writes the specified debugging message only when the Boolean condition is true.

7
New cards

Debug.WriteLineIf(condition, "Value is invalid");

Writes the specified debugging message followed by a new line only when the Boolean condition is true.

8
New cards

Debug.Assert(age >= 0);

Checks that the specified condition is true and reports an assertion failure when the condition is false.

9
New cards

Debug.Assert(age >= 0, "Age cannot be negative");

Checks a condition and reports the supplied message if the assertion fails.

10
New cards

Debug.Assert(value != null, "Value must not be null", "Check the initialization logic.");

Checks a condition and provides additional diagnostic information when the assertion fails.

11
New cards

Debug.Fail("Unexpected code path reached");

Emits an assertion failure indicating that execution reached a location that should not normally be reached.

12
New cards

Debug.Fail("Invalid state", "State should have been initialized earlier.");

Emits an assertion failure with both a primary message and additional diagnostic details.

13
New cards

Debug.Indent();

Increases the indentation level applied to subsequent Debug output.

14
New cards

Debug.Unindent();

Decreases the indentation level applied to subsequent Debug output.

15
New cards

Debug.IndentLevel = 2;

Sets the current indentation level used for Debug output.

16
New cards

int level = Debug.IndentLevel;

Gets the current indentation level used by Debug output.

17
New cards

Debug.IndentSize = 4;

Sets the number of spaces represented by each indentation level.

18
New cards

int size = Debug.IndentSize;

Gets the number of spaces used for each Debug indentation level.

19
New cards

Debug.Flush();

Flushes buffered debugging output to the attached trace listeners.

20
New cards

Debug.Close();

Flushes output and closes the trace listeners associated with Debug.

21
New cards

Assertion

A debugging check that verifies an expected condition in program logic and reports a failure when that condition is false.

22
New cards

Debug vs Console.WriteLine

Debug.WriteLine() is intended for diagnostic/debugging output and is conditionally compiled for DEBUG builds, whereas Console.WriteLine() writes ordinary program output to the console during normal execution.