Code Works in LINQPad 5 But Fails in LINQPad6
Attached code works in LINQPad 5 but not in LINQPad 6. I was just trying to do some logging with serilog.
LINQPad 6 fails with error : "Could not find file 'C:\Users\******\AppData\Local\LINQPad\6.3.3\ProcessServer\3.0.0-x64\LINQPad6.Query.deps.json'"
Packages used
code
LINQPad 6 fails with error : "Could not find file 'C:\Users\******\AppData\Local\LINQPad\6.3.3\ProcessServer\3.0.0-x64\LINQPad6.Query.deps.json'"
Packages used
code
void Main()
{
var configuration = new ConfigurationBuilder()
.SetBasePath(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath)))
.AddJsonFile("appsettings.json")
.Build();
var logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.CreateLogger();
logger.Error("Hello, world!");
}
Comments
In the meantime, you could create a similar file yourself:
You can get the same error just by doing a C# statement of "var context = DependencyContext.Default;" with a single nuget reference to Microsoft.Extensions.DependencyModel.
From an API perspective, AFAICT another alternative would be to explicitly build the DependencyContext being passed in to serilog's ReadFrom.Configuration so that it wouldn't attempt to build the default one.