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

Unable to use System.Text.Json iin Jupyter c# kernel #42

Closed
4 of 14 tasks
viblo opened this issue Nov 13, 2019 · 4 comments · Fixed by dotnet/try#696
Closed
4 of 14 tasks

Unable to use System.Text.Json iin Jupyter c# kernel #42

viblo opened this issue Nov 13, 2019 · 4 comments · Fixed by dotnet/try#696
Assignees

Comments

@viblo
Copy link

viblo commented Nov 13, 2019

Describe the bug

I just installed the c# jupyter kernel today for trying out. I can not get System.Text.Json namespace to import. If I do
using System.Text.Json;
I get this error
(1,19): error CS0234: The type or namespace name 'Json' does not exist in the namespace 'System.Text' (are you missing an assembly reference?)
I also tried to reference it as a nuget package, with
#r "nuget:System.Text.Json"
and it complete successful, but I still cannot use the namespace.

If I run Environment.Version from within the notebook I get 3.0.0 back. And dotnet --version shows 3.0.100 so I think I have the proper version installed.

I have installed some other packages, for example MongoDB.Driver could be installed with nuget and imported with using just fine, so it seems its something specifically with this package.

Did this error occur while using dotnet try or online?

  • dotnet-try
  • online

What kind of error was it?

  • User Interface (UI): For example the output never displayed
  • Service Error: For example "The service is temporarily unavailable. We are working on it"
  • Other:

Screenshots

image

Please complete the following:

  • OS
    • Windows 10
    • macOS
    • Linux (Please specify distro)
    • iOS
    • Android
  • Browser
    • Chrome
    • Edge
    • Safari
    • Firefox
@jonsequitur jonsequitur self-assigned this Nov 14, 2019
@KevinRansom
Copy link
Member

This works with the contents of master branch.

using System.Text.Json;
var jsonException = new JsonException();
var location = jsonException.GetType().Assembly.Location;
Console.WriteLine("{0}", location);

image

I think I will update the test slightly though.

@jonsequitur jonsequitur transferred this issue from dotnet/try Jan 24, 2020
@osmanzeki
Copy link

osmanzeki commented Jun 27, 2020

I tried this today and seem to have a similar (or same?) issue. In this case, I am running the C# kernel in Jupyter in Windows 10 WSL.

In VSCode integration:
image

In a browser notebook:
image

Also, I am using Anaconda, basically following these general steps:
https://www.hanselman.com/blog/AnnouncingNETJupyterNotebooks.aspx

@jonsequitur
Copy link
Contributor

@osmanzeki Can you run #!about in the notebook and post the version here? Thanks.

@osmanzeki
Copy link

osmanzeki commented Jun 29, 2020

@osmanzeki Can you run #!about in the notebook and post the version here? Thanks.

@jonsequitur Ok, I tried running that command and noticed that nothing was happening at all. Its then that I realized that I had installed the kernels using the command listed in Scott's article:

dotnet try jupyter install

Which is the one causing issues actually! I just now noticed that one should install using interactive in order for things to work properly (as instructed here):

dotnet interactive jupyter install

I failed to realize that there were basically two different sets of kernels out there.

I can confirm that everything works fine now on my end with the interactive kernels (System.Text.Json loads properly) and that I do get the output of #!about in that kernel.

image

As a new user to these, I don't exactly know what the difference is between dotnet-try and dotnet-interactive, that confusion was the main source of the problem in my case.

Hope this is helpful to someone else playing with these out there. Thanks for the help @jonsequitur !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants