Skip to content

Missing Null Annotation With Null Default Value For Parameter #192

@JasonBock

Description

@JasonBock
using Rocks;
using System;

public class NeedsNullable
{
	protected virtual void Initialize(object initializationData = null) { }
}

public static class Test
{
	public static void Go()
	{
		var expectations = Rock.Create<NeedsNullable>();
	}
}

Initialize() has a parameter, object initializationData = null. Doing a "Go To Definition" doesn't show the parameter with a "?", though it really should be. It's OK in an override to change it to have ?. So, the fix seems to be that if a parameter is optional, and the default value is null, it should be annotated with ?.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions