Roslyn: EV Error BC36946 using NameOf with Async Function

Created on 5 Nov 2017  路  1Comment  路  Source: dotnet/roslyn

Version Used:
VB 15.4
Steps to Reproduce:

  1. copy program fragment below in VB code window
       Private Async Function B_Async(_document As Document, _CancellationToken As CancellationToken) As Task(Of Document)
            Debug.WriteLine($"#Codefix Entering {NameOf(B_Async)}")
            Return Nothing
        End Function

Expected Behavior:
No Errors
Actual Behavior:
Error BC36946 The implicit return variable of an Iterator or Async method cannot be accessed.

Area-Compilers Bug Language-VB help wanted

Most helpful comment

@paul1956 In case you (or someone else finding this issue) still need/want a workaround, you can use NameOf(Me.B_Async), which seems obvious but eluded me for a while.

>All comments

@paul1956 In case you (or someone else finding this issue) still need/want a workaround, you can use NameOf(Me.B_Async), which seems obvious but eluded me for a while.

Was this page helpful?
0 / 5 - 0 ratings