CS8602
The C# compiler warning 'dereference of a possibly null reference', raised when code uses a value that might be null without checking it.
In more detail
It is a warning, so the program still builds unless warnings are errors. Fix it with a null check or pattern rather than silencing it with the null-forgiving operator.
Related terms
- nullable reference types — A C# compiler feature that tracks whether each reference might be null and warns when code uses one without checking.
- dereference — Following a reference or pointer to reach the value it points at.
- null-forgiving operator — A postfix exclamation mark, as in code!.Length, that tells the compiler to assume a value is not null and suppress the nullable warning.
- compiler warning — A message from the compiler or an analyzer about code that builds but is probably wrong, identified by a code such as CS8602.
Taught in
- The C# Language: Types, Variables, and Flow Control — Modern .NET Core, C# & Enterprise Microservices