-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
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 FunctionSome 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
Contextdoes not cause the exception. - Just creating the
Contextdoes not cause the issue. You need to use theDbContextsuch that theOnModelCreatingmethod is called. As long as that is called beforeWidget.Create(Enumerable.Empty(Of Object)).ToList()is called , then the exception will occur.
- Calling it before creating the
Widget.Createmust be generic. If you change it toCreate() As IWidget(Of Object)and make it returnNew Implementation(Of Object)(Enumerable.Empty(Of Object)), then the error does not occur.- In the database model, the
Betatype must have a navigation property toAlpha. If you remove theBeta.Alphasproperty, 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-latestGitHub runner- x64
Other information
This is the same problem as #123254, but with different code.