Skip to content

Weird FileLoadException when using old library and .NET 10 #126126

@zvirja

Description

@zvirja

Description

I stumbled upon a very weird error which I believe is a regression in the runtime. It happens when I use a very old pre-compiled library and invoke a very ordinary method inside of it.

Reproduction Steps

  1. Build and run the attached program using .NET 10.0.201 SDK

ClrBugRepro.zip

Expected behavior

Program just works

Actual behavior

Program fails with an extremely weird error:

C:/Projects_Playground/ClrBugRepro/bin/Debug/net10.0/ClrBugRepro.exe
Unhandled exception. System.IO.FileLoadException: Unable to load file 'C:\Projects_Playground\ClrBugRepro\bin\Debug\net10.0\C5.dll'.
   at C5.TreeSet`1.Node.CopyNode(Node& cursor, Int32 maxsnapid, Int32 generation)
   at C5.TreeSet`1.Node.CopyNode(Node& cursor, Int32 maxsnapid, Int32 generation)
   at C5.TreeSet`1.Update(T item, T& olditem)
   at Program.<Main>$(String[] args) in C:\Projects_Playground\ClrBugRepro\Program.cs:line 7

It totally makes no sense to say that file is not found when you are already deeply inside the assembly 🤯

Regression?

Yes, it is a regression. It works perfectly fine with .NET 6 and .NET 8. The regression starts somewhere in .NET 9.

Known Workarounds

None if I want to use the existing DLL.

I tried re-compiling it using modern SDK and it seems it fixed the issue. Yet I want to use the original old NuGet package, as otherwise it's a bit of a mess.

Configuration

I don't think environment is relevant, but:

  • Run on Windows 11
  • SDK 10.0.201
  • x64

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIuntriagedNew issue has not been triaged by the area owner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions