Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
unbreak non-FW builds
  • Loading branch information
Metadorius committed Apr 3, 2026
commit ef2c11aec496538e357da95d39366ae35be15f1d
22 changes: 14 additions & 8 deletions src/runtime/Loader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,22 @@ public unsafe static int Initialize(IntPtr data, int size)
// Version=0.0.0.0 vs the 4.0.2.0 shim on disk). Binding redirects
// via config files can't be injected after AppDomain creation, so
// resolve assemblies from our runtime directory directly.
AppDomain.CurrentDomain.AssemblyResolve += (_, args) =>
// Only needed on .NET Framework; on .NET (Core) this causes
// duplicate assembly loads, as .deps.json is respected and
// the correct assembly is already found.
if (typeof(object).Assembly.GetName().Name == "mscorlib")
{
var name = new System.Reflection.AssemblyName(args.Name);
var dir = Path.GetDirectoryName(typeof(Loader).Assembly.Location);
var path = Path.Combine(dir, name.Name + ".dll");
AppDomain.CurrentDomain.AssemblyResolve += (_, args) =>
{
var name = new System.Reflection.AssemblyName(args.Name);
var dir = Path.GetDirectoryName(typeof(Loader).Assembly.Location);
var path = Path.Combine(dir, name.Name + ".dll");

return File.Exists(path)
? System.Reflection.Assembly.LoadFrom(path)
: null;
};
return File.Exists(path)
? System.Reflection.Assembly.LoadFrom(path)
: null;
};
}

var dllPath = Encodings.UTF8.GetString((byte*)data.ToPointer(), size);

Expand Down
Loading