Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect nullability for nested class containing an async method in the parent class #66

Open
PhilipAlexanderWallin opened this issue Mar 4, 2021 · 0 comments

Comments

@PhilipAlexanderWallin
Copy link

PhilipAlexanderWallin commented Mar 4, 2021

I noticed "Unknown" nullability was given for a nested class when the parent class contains an async method. The use case I have is I have an async unit test which use a nested test class for the unit tests of a factory method. The following is a minimal example of the problem, given the method "Test" in run in a nullable context, note that it works as expected if the async "Test" method is removed:

static void Main(string[] args)
{
	// Gives Nullability: NotNullable
	var data = typeof(StringData).GetProperties().First().ToContextualProperty();
	
	// Gives Nullability: Unknown
	var dataInner = typeof(Outer.StringDataInner).GetProperties().First().ToContextualProperty();
}

public class Outer
{
	public async Task Test()
	{
		await Task.Delay(1);
	}

	public class StringDataInner
	{
		public string Text { get; } = string.Empty;
	}
}

public class StringData
{
	public string Text { get; } = string.Empty;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant