interactive icon indicating copy to clipboard operation
interactive copied to clipboard

Polyglot notebook issue with EF

Open cpateldev opened this issue 10 months ago • 4 comments

Describe the bug

I am using VS Code Polyglot notebook extension with .ipynb notebook to test EF functionality. This feature used to work before but suddenly stopped. Here is the command that I am using

#!connect mssql --create-dbcontext --kernel-name OracleHR "Server=cpateldev;Database=OracleHR;User Id=sa;Password=!Sa@dmin;Encrypt=yes;Trust Server Certificate=Yes;"

Error that I get is as below

Scaffolding a DbContext and initializing an instance of it called OracleHR in the C# kernel. Error: Microsoft.Identity.Client version 4.66.2 cannot be added because version 4.66.1 was added previously.

Please complete the following:

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

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

Screenshots

If applicable, add screenshots to help explain your problem.

Image

Image

cpateldev avatar Apr 19 '25 00:04 cpateldev

NOTE: OracleHR is just name of the MSSQLServer database hosted in local docker container

cpateldev avatar Apr 19 '25 00:04 cpateldev

FYI, I was able to workaround this issue by explicitly importing the package version mentioned in the error message. Adding this:

#r "nuget: Microsoft.Identity.Client, 4.66.2"

before the #!connect command works for me.

jarrodldavis avatar Jul 18 '25 22:07 jarrodldavis

FYI, I was able to workaround this issue by explicitly importing the package version mentioned in the error message. Adding this:

#r "nuget: Microsoft.Identity.Client, 4.66.2" before the #!connect command works for me.

By executing the above line before importing [ #r "nuget:Microsoft.DotNet.Interactive.SqlServer,-" ] package solves the issue. I am now able to execute EF DBContext using C# linq to EF.

cpateldev avatar Jul 19 '25 15:07 cpateldev

I confirmed that the bug is still there, so it's good to leave this open until there's a fix.

jonsequitur avatar Jul 20 '25 00:07 jonsequitur