dotnet/roslyn

Wrong error message for Task.Run with invalid argument

Aperta

#10.672 aperta il 19 apr 2016

 (1 commento) (0 reazioni) (0 assegnatari)C# (4257 fork)batch import
Area-CompilersConcept-Diagnostic ClarityInvestigatinghelp wanted

Metriche repository

Star
 (20.414 stelle)
Metriche merge PR
 (Merge medio 6g 17h) (256 PR mergiate in 30 g)

Descrizione

Version Used: VS 2015 U2

Steps to Reproduce:

Write the following erroneous C# statement:

Task.Run(() => { }, TaskCreationOptions.LongRunning);

Expected Behavior:

A reasonable error, probably:

CS1503 Argument 2: cannot convert from 'System.Threading.Tasks.TaskCreationOptions' to 'System.Threading.CancellationToken'

Actual Behavior:

Incorrect error message:

CS1643: Not all code paths return a value in lambda expression of type 'Func'

This is possibly related to #8603.

Guida contributor