Using dotnet-script with C# Interactive
I'm trying out Rider on Linux at the moment and I'm really liking it so far. I'm trying to get the C# Interactive window to work properly. I'm using dotnet core, and do not have mono installed. Dotnet core has dotnet-script support with will run script files or produce an interactive window. I set the path to the file, but when I run it, I get the error Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read.
Is there a way to get this to work with rider? I can run it from a regular terminal window, even within Rider, it just doesn't seem to work in the C# interactive window.
Please sign in to leave a comment.
The same here on windows. For a C#-beginner it is very hard to distiguish between all these C#-Frameworks and variants.
It costed me 2 hours just fo find out that i can't simply use the dotNetCore-HttpClient with the C#Interactive-Console, but have to use https://github.com/filipw/dotnet-script instead. Or better: that's my understanding at the moment ;).
It would be very helpful, if Rider would habe a better support here for the C#-Jungle.
Hello @...,
Just in case you've missed this issue was fixed - https://github.com/filipw/dotnet-script/pull/417.
Thank you.
Hello gratinierer,
Could you please specify what you expect as better support?
Thank you.
I'm trying to integrate dotnet-script with Rider on Ubuntu. Set path to /home/user/.dotnet/tools/.store/dotnet-script/0.52.0/dotnet-script/0.52.0/tools/netcoreapp3.1/any/dotnet-script.dll , but it doesnt work. Got error
/home/user/.dotnet/tools/.store/dotnet-script/0.52.0/dotnet-script/0.52.0/tools/netcoreapp3.1/any/dotnet-script.dll --
The entry point method could not be loaded due to Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
Process finished with exit code 1
Is it possible to make it work on linux?
Hello @...,
Could you clarify if you are using any dependencies in this project (#r / #load directives)? If you do, kindly share the list of dependencies.
Hi! Just open C# Interactive and immediately get the error. There is no code at all
Thank you for the information @...
You mentioned that the path is set to dotnet-script.dll. I want to note that path in Rider's tool settings for C# Interactive should point to the following location when using dotnet-script if the tools was installed globally:
Could you change the path to the one noted above and let me know your feedback?
/home/user/.dotnet/tools/dotnet-script --
A fatal error occurred. The required library libhostfxr.so could not be found.
If this is a self-contained application, that library should exist in [/home/user/.dotnet/tools/.store/dotnet-script/0.52.0/dotnet-script/0.52.0/tools/netcoreapp3.1/any/].
If this is a framework-dependent application, install the runtime in the global location [/usr/share/dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet/install_location].
The .NET Core runtime can be found at:
- https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=ubuntu.20.04-x64
Process finished with exit code 131 (interrupted by signal 3: SIGQUIT)
It works from terminal window
This behavior indicates that Rider uses a different set of environment variables than your terminal session, for example when .NET Core is installed via snap.
You can check it using echo $PATH and echo $DOTNET_ROOT in your terminal window and inside the Rider's Terminal tab to see if they match. If this is the case, you can add the appropriate values to PATH and DOTNET_ROOT to .profile and source it.
Please let me know if it helps.
Output is the same
user@pc6028:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:~/.dotnet/tools:/home/user/dotnet
user@pc6028:~$ echo $DOTNET_ROOT
/home/user/dotnet
Thank you for the information @...,
Could you check if PATH and DOTNET_ROOT are the same when using env / printenv just like when using echo?