-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Closed
Copy link
Labels
Description
Description
A specific class definition results in an EntryPointNotFoundException when running on the .NET runtime 10.0.2. The same code runs without error on .NET runtime 10.0.1.
Reproduction Steps
Reproduction is here: https://github.com/reduckted/repro-dotnet-runtime
The error is:
> dotnet run --project VB
Unhandled exception. System.EntryPointNotFoundException: Entry point was not found.
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at VB.Program.Main(String[] args) in /home/runner/work/repro-dotnet-runtime/repro-dotnet-runtime/VB/Program.vb:line 5
Here's a copy of the code for reference:
Public NotInheritable Class Program
Public Shared Function Main(args() As String) As Integer
Dim w As New Widget(Of Integer)
w.ToList()
Console.WriteLine("Completed")
Return 0
End Function
End Class
Public Class Widget(Of T)
Implements IWidget(Of T)
Public ReadOnly Property Count As Integer Implements IReadOnlyCollection(Of T).Count
Public Function GetEnumerator() As IEnumerator(Of T) Implements IEnumerable(Of T).GetEnumerator
Return Enumerable.Empty(Of T)().GetEnumerator()
End Function
Private Function IEnumerable_GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator
Return GetEnumerator()
End Function
End Class
Public Interface IWidget(Of T)
Inherits IReadOnlyCollection(Of T)
End InterfaceSome things to note:
- The
IWidgetclass must be generic. Changing it toIWidgetand inheriting fromIReadOnlyCollection(Of Integer)runs without error. - The
Widgetclass can be changed to be non-generic by implementingIWidget(Of Integer)and the exception still occurs. - Equivalent code in C# runs without error.
Here is a workflow run that shows it succeeding for .NET 10.0.1 and failing for 10.0.2:
https://github.com/reduckted/repro-dotnet-runtime/actions/runs/21063712505
Expected behavior
The code runs without error.
Actual behavior
System.EntryPointNotFoundException: Entry point was not found.
Regression?
Yes. This worked in .NET 10.0.1.
Known Workarounds
None.
Configuration
- .NET 10.0.2
ubuntu-latestGitHub runner- x64
Other information
No response
snakefoot