// Synthesized methods have no ordinal stored in custom debug information (only user-defined methods have ordinals).
// In case of async lambdas, which synthesize a state machine type during the following rewrite, the containing method has already been uniquely named,
// so there is no need to produce a unique method ordinal for the corresponding state machine type, whose name includes the (unique) containing method name.
Diagnostic(ERRID.ERR_EncUpdateFailedMissingAttribute).WithArguments("Public Function F() As IEnumerable(Of Integer)","System.Runtime.CompilerServices.IteratorStateMachineAttribute"))
Diagnostic(ERRID.ERR_EncUpdateFailedMissingAttribute,"F").WithArguments("Public Function F() As IEnumerable(Of Integer)","System.Runtime.CompilerServices.IteratorStateMachineAttribute").WithLocation(6,30))
Diagnostic(ERRID.ERR_EncUpdateFailedMissingAttribute,"F").WithArguments("Public Function F() As IEnumerable(Of Integer)","System.Runtime.CompilerServices.IteratorStateMachineAttribute").WithLocation(12,30))
EndSub
<Fact>
PublicSubAddedIteratorStateMachineAttribute()
Dimsource0=MarkedSource("
Imports System
Imports System.Collections.Generic
Class C
Public Iterator Function F() As IEnumerable(Of Integer)
Dim <N:0>a</N:0> As Integer = 0
<N:1>Yield 0</N:1>
Console.WriteLine(a)
End Function
End Class
")
Dimsource1=MarkedSource("
Imports System
Imports System.Collections.Generic
Namespace System.Runtime.CompilerServices
Public Class IteratorStateMachineAttribute
Inherits Attribute
Sub New(type As Type)
End Sub
End Class
End Namespace
Class C
Public Iterator Function F() As IEnumerable(Of Integer)
Diagnostic(ERRID.ERR_EncUpdateFailedMissingAttribute).WithArguments("Public Function F() As Task(Of Integer)","System.Runtime.CompilerServices.AsyncStateMachineAttribute"),
Diagnostic(ERRID.ERR_EncUpdateFailedMissingAttribute).WithArguments("Public Function F() As Task(Of Integer)","System.Runtime.CompilerServices.AsyncStateMachineAttribute"))
Diagnostic(ERRID.ERR_EncUpdateFailedMissingAttribute,"F").WithArguments("Public Function F() As Task(Of Integer)","System.Runtime.CompilerServices.AsyncStateMachineAttribute").WithLocation(15,27))
Diagnostic(ERRID.ERR_EncUpdateFailedMissingAttribute,"F").WithArguments("Public Function F() As Task(Of Integer)","System.Runtime.CompilerServices.AsyncStateMachineAttribute").WithLocation(15,27))
EndSub
<Fact>
PublicSubNonIteratorToIterator_MissingAttribute()
Dimsource0=MarkedSource("
Imports System.Collections.Generic
Class C
Public Function F() As IEnumerable(Of Integer)
Dim <N:0>a</N:0> As Integer = 0
<N:1>Return { 0 }</N:1>
End Function
End Class
")
Dimsource1=MarkedSource("
Imports System.Collections.Generic
Class C
Public Iterator Function F() As IEnumerable(Of Integer)
Diagnostic(ERRID.ERR_EncUpdateFailedMissingAttribute,"F").WithArguments("Public Function F() As IEnumerable(Of Integer)","System.Runtime.CompilerServices.IteratorStateMachineAttribute").WithLocation(5,30))