Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
14 tasks
johngardner58work opened this issue Oct 2, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@johngardner58work
Copy link

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
Copy link
Author

Here is a screenshot of the Serilog.dll I replaced with the latest Serilog.dll. You can see this is the same hash that it was trying to load. located here: userprofile.nuget\packages\microsoft.dotnet-interactive\1.0.522904\tools\net8.0\any\Serilog.dll
image. I needed it to load the installed package. I couldn't get it to do that so I just replaced the dll with the correct one and then my script executed just fine.

@jonsequitur jonsequitur added the bug Something isn't working label Oct 2, 2024
@jonsequitur
Copy link
Contributor

This PR might resolve this for you tactically.

Allowing completely separate assemblies from the ones that .NET Interactive itself depends on is a larger piece of work that's been discussed but so far not worked on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants