Dispose DependencyContextJsonReader after using

This commit is contained in:
Julius Vitkauskas
2022-11-01 12:49:37 +02:00
committed by Gustas
parent bd882c98c7
commit 4517734fbe

View File

@@ -265,12 +265,14 @@ namespace OpenRA.Support
public static AssemblyLoadContextBuilder AddDependencyContext(this AssemblyLoadContextBuilder builder, string depsFilePath)
{
var reader = new DependencyContextJsonReader();
using (var file = File.OpenRead(depsFilePath))
using (var reader = new DependencyContextJsonReader())
{
var deps = reader.Read(file);
builder.SetBaseDirectory(Path.GetDirectoryName(depsFilePath));
builder.AddDependencyContext(deps);
using (var file = File.OpenRead(depsFilePath))
{
var deps = reader.Read(file);
builder.SetBaseDirectory(Path.GetDirectoryName(depsFilePath));
builder.AddDependencyContext(deps);
}
}
return builder;