Skip to content

VB.NET program using .NET runtime 10.0.3 throws EntryPointNotFoundException #124369

@reduckted

Description

@reduckted

Description

A specific class definition combined with other specific classes and a specific execution path results in an EntryPointNotFoundException when running on the .NET runtime 10.0.3. 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:

Unhandled exception. System.EntryPointNotFoundException: Entry point was not found.
   at System.Collections.Generic.IEnumerable`1.GetEnumerator()
   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 12

This is similar code to what was used to reproduce #123254. The particular reproduction for that issue was fixed in 10.0.3, but the underlying problem still appears to exist.

There are a few more parts to the code, but the application entry point looks like this:

    Public Shared Function Main(args() As String) As Integer
        Widget.Create(Enumerable.Empty(Of Object)).ToList()

        Using context = CreateContext()
            context.Alphas.ToList()
        End Using

        Console.WriteLine("Completed")

        Return 0
    End Function

Some things to note:

  • There is an Entity Framework 6 database context being created and used. I don't know if EF6 must be used, but it was the only way I could reproduce this bug.
  • The EF6 database context is using an Effort in-memory database. I cannot say for sure that this is required to cause the bug, but I haven't been able to reproduce the bug using a real database.
  • The call to Widget.Create(Enumerable.Empty(Of Object)).ToList() must be after the database context has been created and initialized.
    • Calling it before creating the Context does not cause the exception.
    • Just creating the Context does not cause the issue. You need to use the DbContext such that the OnModelCreating method is called. As long as that is called before Widget.Create(Enumerable.Empty(Of Object)).ToList() is called , then the exception will occur.
  • Widget.Create must be generic. If you change it to Create() As IWidget(Of Object) and make it return New Implementation(Of Object)(Enumerable.Empty(Of Object)), then the error does not occur.
  • In the database model, the Beta type must have a navigation property to Alpha. If you remove the Beta.Alphas property, the bug does not occur.

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.

A workflow run shows that this ran successfully on 10.0.1, but fails on 10.0.2 and 10.0.3.
https://github.com/reduckted/repro-dotnet-runtime/actions/runs/21981563123

Known Workarounds

None.

Configuration

  • .NET 10.0.3
  • ubuntu-latest GitHub runner
  • x64

Other information

This is the same problem as #123254, but with different code.

/cc @MichalStrehovsky @davidwrighton

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions