interactive
interactive copied to clipboard
System.Net.Http.Json not recognized
Describe the bug
After loading System.Net.Http.Json the assembly is not loaded:
#r "nuget:System.Net.Http.Json"
using System.Net.Http.Json;
results in
The type or namespace name 'Json' does not exist in the namespace 'System.Net.Http' (are you missing an assembly reference?)
This happened as soon as I installed the latest version of Polyglot Notebooks in VS code requiring .Net 8.
Seems the same as this issue
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
- [x] Edge
- [ ] Firefox
- [ ] Safari
- Frontend
- [ ] Jupyter Notebook
- [ ] Jupyter Lab
- [ ] nteract
- [x] Visual Studio Code
- [ ] Visual Studio Code Insiders
- [ ] Visual Studio
- [ ] Other (please specify)
Screenshots
I've also experienced this issue.
My workaround was to downgrade the Polyglot notebook version to 1.0.456201 which worked as expected.
I'm seeing this issue as well. I wrote an extension method as a work around for ReadFromJsonAsync:
public static async Task<T> ReadJsonAsync<T>(this HttpContent response ){
return await response.ReadAsStringAsync().
ContinueWith<T>(s=>JsonSerializer.Deserialize<T>(s.Result));
}
any news about this?
This doesn't work because System.Text.Json.Http is a framework assembly. If you use #r without the nuget prefix it will work:
#r "System.Net.Http.Json"
using System.Net.Http.Json;
Thanks!