interactive icon indicating copy to clipboard operation
interactive copied to clipboard

It would seem that .NET Interactive uses Serilog internally and this causes problems when trying to use Serilog.dll in a script

Open johngardner58work opened this issue 4 months ago • 2 comments

I found the Serilog.dll here .nuget\packages\microsoft.dotnet-interactive\1.0.522904\tools\net8.0\any but it was an older version. I loaded the following

#r "nuget:Microsoft.Extensions.Logging,8.0.0" #r "nuget:Serilog, 4.0.2" #r "nuget:Serilog.Extensions.Logging, 8.0.0" #r "nuget:Serilog.Settings.Configuration, 8.0.2" #r "nuget:Serilog.Sinks.Console, 6.0.0" #r "C:\Users\GARDNERJ.nuget\packages\serilog\4.0.2\lib\net8.0\Serilog.dll" #r "C:\Users\GARDNERJ.nuget\packages\serilog.extensions.logging\8.0.0\lib\net8.0\Serilog.Extensions.Logging.dll"

But on run got FileIOException unable to load Serilog.dll the hash matched the version in the path at the top but the packages were installed to the path pointed to by #r. I had to replace the Serilog.dll from where it was installed to the path at the top. Then it could load the Serilog.dll. My guess is that .NET Interactive used Serilog.dll but an older version.

Which version of .NET Interactive are you using? (In a notebook, run the #!about magic command. ):

1.0.522904+cdfa48b2ea1a27dfe0f545c42a34fd3ec7119074

  • OS
    • [ x] Windows 11
    • [ ] Windows 10
    • [ ] macOS
    • [ ] Linux (Please specify distro)
    • [ ] iOS
    • [ ] Android
  • Browser
    • [ ] Chrome
    • [ ] Edge
    • [ ] Firefox
    • [ ] Safari
  • Frontend
    • [ ] Jupyter Notebook
    • [x ] Jupyter Lab
    • [ ] nteract
    • [x ] Visual Studio Code
    • [ ] Visual Studio Code Insiders
    • [ ] Visual Studio
    • [ ] Other (please specify)

Screenshots

Besides the file IO exception unable to load DLL it was also issuing a warning which is probably more to the point: image The 2.0.0.0 version was the version in the .net interactive package location that's the one I replaced. There is no 4.0.0.0 with the has indicated. The hash for 4.0.0.0 was different.

johngardner58work avatar Oct 02 '24 14:10 johngardner58work