dotnet / dotnet/dotnet-api-docs

NullReferenceException "Remarks" example doesn't build in .NET 6

Open
#8,231 2 comments 0 reactions 0 assignees View on GitHub
area-System.Runtime Pri3
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

https://docs.microsoft.com/en-us/dotnet/api/system.nullreferenceexception?view=net-6.0#remarks

The first code block which is supposed to give warning BC42104 instead gives error CS0165
```using System;
using System.Collections.Generic;

public class Example
{
public static void Main(string[] args)
{
int value = Int32.Parse(args[0]);
List names;
if (value > 0)
names = new List();

names.Add("Major Major Major");
}
}

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.