dotnet/interactive

Polyglot notebook: Assembly version mismatch results in inability to run

Opened this issue · 0 comments

Describe the bug

For my scenario, I'm importing two nuget packages from Serilog: The core Serilog assembly and Serilog.Sinks.File. If I don't specify any versions, it currently pulls Serilog 4.3.0 and Serilog.Sinks.File 7.0.0. When trying to use Serilog in a following cell, I get the error seen in the screenshot below. If I use explicit versions, it'll fix itself. Using latest assemblies with a normal C# application and the code is fine, so something is going on with the way .NET interactive is handling assembly resolution when the minor version mismatches. I've already verified that a patch version difference doesn't show this bug and things work properly.

// Fails because Serilog assembly is 4.3.0
#r "nuget:Serilog"
#r "nuget:Serilog.Sinks.File"
// Works
#r "nuget:Serilog, 4.2.0"
#r "nuget:Serilog.Sinks.File"
// Gets even worse if you want to bring in Serilog.Sinks.Console, but shows a patch version works (Console refs 4.0.0)
#r "nuget:Serilog, 4.0.2"
#r "nuget:Serilog.Sinks.File, 6.0.0"
#r "nuget:Serilog.Sinks.Console, 6.0.0"

Having to specify the explicit versions seems like a problem and considering the normal .NET environment, this works without any user intervention suggests there's something wrong in .NET interactive. Is this perhaps related to automatic binding redirect generation? Is that something .NET interactive doesn't currently support? Can it not support it?

Please complete the following:

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

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

Screenshots

If applicable, please add screenshots of the entire VS Code window.

Image