dotnet/roslyn

Wrong error message for Task.Run with invalid argument

開放

#10,672 建立於 2016年4月19日

 (1 則留言) (0 個反應) (0 位負責人)C# (4,257 個分叉)batch import
Area-CompilersConcept-Diagnostic ClarityInvestigatinghelp wanted

倉庫指標

星標
 (20,414 顆星)
PR 合併指標
 (平均合併 6天 17小時) (30 天內合併 256 個 PR)

描述

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.

貢獻者指南