-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone
Description
Description
The behavior around constrained execution calls observably changed between .net7 preview 5 and preview 6. This was caught by a regression test in the roslyn repository: dotnet/roslyn#63221.
This is an old regression test tracked by the following work item. https://vstfdevdiv/DevDiv2/DevDiv/_workitems/edit/1021941
Reproduction Steps
Create a Visual Basic console application with the following code:
Imports System
Interface IMoveable
Property Position As Integer
End Interface
Class Item
Implements IMoveable
Public Property Name As String
Public Property Position As Integer Implements IMoveable.Position
Get
Console.WriteLine("Position get for item '{0}'", Me.Name)
Return 0
End Get
Set
Console.WriteLine("Position set for item '{0}'", Me.Name)
End Set
End Property
End Class
Class Program
Shared Sub Main()
Dim item = New Item With {.Name = "Goo"}
Shift(item)
End Sub
Shared Sub Shift(Of T As {Class, IMoveable})(item As T)
item.Position += GetOffset(item)
End Sub
Shared Function GetOffset(Of T)(ByRef item As T) As Integer
item = DirectCast(DirectCast(New Item With {.Name = "Bar"}, IMoveable), T)
Return 0
End Function
End ClassAnd the following project file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RootNamespace>vbconsole</RootNamespace>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
</PropertyGroup>
</Project>Expected behavior
C:\Users\jaredpar\code\temp\vbconsole
> dotnet run --configuration Release --framework net6.0
Position get for item 'Goo'
Position set for item 'Goo'
C:\Users\jaredpar\code\temp\vbconsole
> dotnet run --configuration Release --framework net7.0
Position get for item 'Goo'
Position set for item 'Goo'Actual behavior
C:\Users\jaredpar\code\temp\vbconsole
> dotnet run --configuration Release --framework net6.0
Position get for item 'Goo'
Position set for item 'Goo'
C:\Users\jaredpar\code\temp\vbconsole
> dotnet run --configuration Release --framework net7.0
Position get for item 'Goo'
Position set for item 'Bar'Regression?
Yes this is a regression from net7.0 preview 5 and all previous .net runtime releases (core and framework).
Known Workarounds
No response
Configuration
No response
Other information
No response
Metadata
Metadata
Assignees
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI