docs/compilers/Visual Basic/Compiler Breaking Changes - DotNet 10.md
This document lists known breaking changes in Roslyn after .NET 9 general release (.NET SDK version 9.0.100) through .NET 10 general release (.NET SDK version 10.0.100).
Introduced in Visual Studio 2022 version 17.13
The state machine for enumerators incorrectly allowed resuming execution after the enumerator was disposed.
Now, MoveNext() on a disposed enumerator properly returns false without executing any more user code.
Imports System
Imports System.Collections.Generic
Module Program
Sub Main()
Dim enumerator = C.GetEnumerator()
Console.Write(enumerator.MoveNext()) ' prints True
Console.Write(enumerator.Current) ' prints 1
enumerator.Dispose()
Console.Write(enumerator.MoveNext()) ' now prints False
End Sub
End Module
Class C
Public Shared Iterator Function GetEnumerator() As IEnumerator(Of Integer)
Yield 1
Console.Write("not executed after disposal")
Yield 2
End Function
End Class
Microsoft.CodeAnalysis.EmbeddedAttribute is validated on declarationIntroduced in Visual Studio 2022 version 17.13
The compiler now validates the shape of Microsoft.CodeAnalysis.EmbeddedAttribute when declared in source. Previously, the compiler
would allow user-defined declarations of this attribute with any shape. We now validate that:
Namespace Microsoft.CodeAnalysis
' Previously allowed. Now, BC37335
Public Class EmbeddedAttribute
Inherits Attribute
End Class
End Namespace