Skip to content

VB.NET program using .NET runtime 10.0.2 throws EntryPointNotFoundException #123254

@reduckted

Description

@reduckted

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 Interface

Some things to note:

  • The IWidget class must be generic. Changing it to IWidget and inheriting from IReadOnlyCollection(Of Integer) runs without error.
  • The Widget class can be changed to be non-generic by implementing IWidget(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-latest GitHub runner
  • x64

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions