Cs script is busy vs code как исправить

it isn't doing anything else it just throws that error at me i'm on macOS and have tried restarting my computer how can i fix this?

@crackerberries

it isn’t doing anything else it just throws that error at me

i’m on macOS and have tried restarting my computer

how can i fix this?

@oleg-shilo

It might be a side affect of VS updates. One of my PCs started exhibiting the same problem. Will need to investigate.
Thank you for reporting

@oleg-shilo

Well, just realized that it was another VSCode update pending.
After the update has finished and VSCode restarted the problem has gone.

Can you please check that you have installed the latest version of VSCode and the extension.

@oleg-shilo

Something is still not OK. Will have a look.

@oleg-shilo

What version of .NET SDK are you running. Can you please check your dotnet --list-sdks

@oleg-shilo

Getting the very latest update has solved the problem on another machine as well:
image

@crackerberries

Thanks for the interest! I will try applying the changes now.

I have .NET 3.1 and 5. the terminal outputs 3.1.409 [/usr/local/share/dotnet/sdk] 5.0.203 [/usr/local/share/dotnet/sdk]

For clarification, I am on a MacBook Air 2015 running macOS Big Sur.

Hope that helps, and hope your solution works,

crackerberries

@crackerberries

Doesn’t seem to have worked… do I have to add anything else to my project/code before running it? I’ve noticed it doesn’t throw an error the first time I use it after i boot Visual Studio Code, but it also doesn’t output anything.

I haven’t read the documentation, and if this error is a result of my own incompetence, so sorry for wasting your time.

crackerberries

@crackerberries

I cannot make a new CS-Script project, because it just throws the error again.

I’ll try different things and try to find something that works.

crackerberries

@crackerberries

Forgot this:

image

@oleg-shilo

The extension is doing lazy loading so it is not activated until you try to use it. That’s why the problem is not immediate.

I feel that most likely the script engine binaries somehow failed to be deployed.
You can check if they are present (e.g. cscs.dll):

_user_dir = path.join(process.env.HOME!, 'Library', 'Application Support', 'Code', 'User', 'cs-script.user');

if they are try to execute directly from the shell:

And if it works then try «about» command from VSCode:

image

It is the simplest scenario that runs the engine and spits the output to the VSCode output window.

You being on mac makes it really difficult for me to investigate as I do not have mac handy.
Debugging by yourself can be an option but it is not an easy one to take. It will be your time spent on it without any warranty of success.
Sorry mate.

@crackerberries

i’ll spin up a linux and windows vm and try on them

@drowhunter

Windows 10 User here. I get this error as well on fresh install of CS-Script from chocolatey
and version v2.1.0 of the vscode extension

C# Script execution engine (.NET Core). Version 2.0.0.0.
Copyright (C) 2004-2020 Oleg Shilo. www.csscript.net (github.com/oleg-shilo/cs-script.core)

   CLR:             5.0.17
   System:          Microsoft Windows NT 10.0.19044.0
   Architecture:    x64
   Install dir:     <not integrated>
   Script engine:   c:programdatachocolateylibcs-script.coretoolscscs.dll
   Config file:     <none>
   Compiler engine: dotnet (C:Program Filesdotnetdotnet.exe)
   NuGet manager:   dotnet
   NuGet cache:     C:Userstj.nugetpackages
   Custom commands: C:ProgramDatacs-scriptcommands
   Global includes: C:ProgramDatacs-scriptinc

and freshly installed CS-Script plugin

output of —list-sdks

3.1.421 [C:Program Filesdotnetsdk]
6.0.301 [C:Program Filesdotnetsdk]
6.0.302 [C:Program Filesdotnetsdk]

Followed instructions, F1, CS-Script: New C# Script

First execution of script (Green Triangle) nothing happens
Second Click of button CS-Script is busy

@oleg-shilo

It looks like you need to update your CS-Script version.
This is the expected output:

CS-Script.VSCode - v2.1.0
-------------------------------------------------------
C# Script execution engine (.NET Core). Version 4.4.7.0.
Copyright (C) 2004-2020 Oleg Shilo. www.csscript.net (github.com/oleg-shilo/cs-script)

   CLR:             6.0.7
   System:          Microsoft Windows NT 10.0.19042.0
   Architecture:    x64
   Install dir:     C:ProgramDatachocolateylibcs-scripttools
   Script engine:   C:ProgramDatachocolateylibcs-scripttoolscscs.dll
   Config file:     C:ProgramDatachocolateylibcs-scripttoolscss_config.xml
   Compiler engine: csc (C:Program Filesdotnetsdk6.0.302Roslynbincorecsc.dll)
                  : dotnet (C:Program Filesdotnetdotnet.exe)
   NuGet manager:   dotnet
   NuGet cache:     C:Usersoleg.shilo.nugetpackages
   Custom commands: C:ProgramDatacs-scriptcommands
   Global includes: C:ProgramDatacs-scriptinc
-------------------------------------------------------
Syntaxer
   C:ProgramDatachocolateylibcs-syntaxertoolssyntaxer.dll
Extension
   c:Usersoleg.shilo.vscodeextensionsoleg-shilo.cs-script-2.1.0out

I suggest you update your CS-Script as it is not exactly matching the runtime installed. Then we will proceed from there.

You said that it was a fresh install from choco but the version there is 4.4.7 (https://community.chocolatey.org/packages/cs-script)

It is possible you have an old obsolete CS-Script.Core installed (https://community.chocolatey.org/packages/cs-script.core).
If it is the case you will need to remove it and install choco install cs-script.

After MS dropped support for .BNET Framework and renamed .NET Core in just .NET, CS-Script followed the suite and renamed CS-Script.Core in just CS-Script.

@drowhunter

Oh, I see , I figured that since I wanted to use Net Core, I installed the CSScript.Core version instead of CSScript.

I’ve been using CSScript since before Net.Core was a thing but this is the first time reinstalling it in a while.

So is Net.Framework no longer supported? Is CSScript basically .Net now?

I will try uninstalling that older version and hopefully the problem will go away

@oleg-shilo

Yes. CS-Script just followed the .NET roadmap:

@oleg-shilo

Starting from version v2.2.0 any accidental «hanging» of the script being executed can be fixed by CS-Script: reset busy status command

Recommend Projects

  • React photo

    React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo

    Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo

    Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo

    TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo

    Django

    The Web framework for perfectionists with deadlines.

  • Laravel photo

    Laravel

    A PHP framework for web artisans

  • D3 photo

    D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Visualization

    Some thing interesting about visualization, use data art

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo

    Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo

    Microsoft

    Open source projects and samples from Microsoft.

  • Google photo

    Google

    Google ❤️ Open Source for everyone.

  • Alibaba photo

    Alibaba

    Alibaba Open Source for everyone

  • D3 photo

    D3

    Data-Driven Documents codes.

  • Tencent photo

    Tencent

    China tencent open source team.

Я впервые использую код Visual Studio, и я пытаюсь запустить на нем простой код, но он выдает ошибку, которая говорит:

«scriptcs» не распознается как внутренняя или внешняя команда, работающая программа или командный файл.

У меня есть это как код:

using System;

struct Employee{
   public int Id { get; set; }
   public string FullName { get; set; }
}

public class MyClass{
 public static void Main(){
   Employee obj= new Employee();
   obj.FullName = "Hello World";
   Console.WriteLine(obj.FullName);
  }
}

Я попытался установить Scriptcs Runner, но проблема все та же. Кто-нибудь может предложить что-то еще?

< Сильный > Edit:

После многих ваших предложений я попробовал следующее:

  • Создал новую папку без пробелов и назвал файлы одинаково.
  • Переустановил расширение Runner scriptcs из менеджера расширения кода VS.
  • Дважды проверил мой код. Он работает на онлайн-компиляторе c #, но не в VS Code.

Проблема все та же. Получение вышеуказанной ошибки.

3 ответа

Лучший ответ

  1. Откройте Расширения и установите расширение C #: Имя: C #, , Id: ms-vscode.csharp , Описание: C # для Visual Studio Code (работает на OmniSharp). , Издательство: Microsoft Ссылка на VS Marketplace: https://marketplace.visualstudio.com/items?itemName = мс — vscode.csharp

  2. Перейдите на консоль в папку по вашему выбору и создайте новый консольный проект, набрав dotnet new console -o TestConsoleApp Это создаст файл проекта TestConsoleApp.csproj

  3. Запустите VS Code, набрав Code .

  4. В VS Code перейдите в Терминал и выполните dotnet run --project TestConsoleApp, чтобы запустить ваше приложение. Или вы можете начать отладку (F5)

Это должно обеспечить вам хорошее начало, где вы сможете использовать свой код.

Если вы просто хотите использовать фрагменты кода, вы должны попробовать то, что ответил Атанасиос Катарас, но с этим у меня нет опыта.

Для этого есть также видео-введение по адресу . https://channel9.msdn.com/Blogs/dotnet/Get-started-VSCode-Csharp-NET-Core-Windows


1

Mihaeru
10 Дек 2019 в 07:58

Вам нужно как расширение для запуска скриптов, так и для установки скриптов

Руководство по установке и информации находится здесь: http://scriptcs.net/

  1. Установить шоколадный
  2. Запустите cinst scriptcs, чтобы установить последнюю версию.

Затем убедитесь, что вы установили расширение для запуска сценариев в соответствии с данным руководством: https : //www.strathweb.com/2015/11/running-c-scripts-and-snippets-in-visual-studio-code-with-scriptcs/

Расширение может быть установлено непосредственно из кода VS:

  1. нажмите F1
  2. введите ext install scriptcsRunner
  3. выберите «установить»


0

Athanasios Kataras
10 Дек 2019 в 07:03

Проблема не в коде VS. проблема в том, что ваш код неверен. строка с выводом на консоль должна находиться в другой области, например, в конструкторе.

using System;
struct Employee
{
    public int Id { get; set; }
    public string FullName { get; set; }
}

public class MyClass
{
    Employee obj = new Employee();

    public MyClass()
    {
            Console.WriteLine(obj.FullName);
    }
}


-1

Igor Zhurba
10 Дек 2019 в 07:07

CS-Script — VSCode Extension (CS-Script.VSCode)

vs marketplace

downloads

rating

paypal

Execution, debugging and editing C# scripts (powered by CS-Script engine) that target .NET Core.
A single C# file is all that is required to run the script.

This extension depends on another VSCode extension «ms-dotnettools.csharp». Thus if these extensions are installed but function incorrectly please log error reports at their corresponding web sites.


Note, the only dependency that you need to install to use this extension is .NET. The rest is included in the extension itself.

Though there are some strong benefits in managing CS-Script separatelly from the extension. A siple guide for that can be found here.


Further Help/Documentation

The scope of this page is limited to integration of CS-Script with VSCode and the documentation for CS-Script itself can be found at the locations below:

  • CS-Script generic topics
  • CS-Script for .NET Core specific topics

Overview

The extension implements its own Roslyn-based Intellisense functionality fully integrated with VSCode infrastructure. Though you can always opt to the VSCode built-in Intellisense engine OmniSharp. See Using CS-Script IntelliSense section for details.

The extension is powered by the CS-Script engine — popular Open Source script engine that delivers Python scripting experience but for C# syntax. CS-Script uses ECMA-compliant C# as a programming language and it can be hosted by applications or run standalone. CS-Script is already a core of the plugins for some other popular editors/IDEs:

  • Sublime Text 3 — CS-Script.ST3
  • Notepad++ — CS-Script.Npp
  • Visual Studio 2015/2017 — CS-Script.VSIX

The extension provides a thin layer of own functionality. Its primary responsibility is bringing together IntelliSense services, a full scale debugger (curtesy of «Mono Debug» team) and CS-Script seamless C# script execution. This page contains only a light overview of the extension functionality. The complete description can be found at the project Wiki.

Quick start

  1. Close any opened folder (workspace)
  2. Create new C# script (command: CS-Script: New C# script)
  3. Edit script to meet your requirements
  4. Execute or debug script in VSCode
  5. If required, execute the script outside of VSCode (see next section)

image

Executing script outside of VSCode

The extension comes with the complete CS-Script package. You can find the location of the script engine cscs.dll by executing CS-Script: About command.
It may be a good idea to add the location of the script engine launcher cscs.exe into the system PATH environment variable. If you install CS-Script from Choco (windows) or via Linux package then the script engine launcher is added to PATH automatically.

This is how you can execute the script from the command shell:

dotnet cscs.dll my_script.cs

If CS-Ssript installed

cscs my_script.cs

You can also install CS-Script system wide. For Windows it is recommended to use Chocolaty (Windows equivalent of Linux apt-get).
On Linux you can install Debian package. See instructions here: https://github.com/oleg-shilo/cs-script/wiki/CS-Script-on-Linux


Apart from the common VSCode C# functionality the extension brings CS-Script specific user activities in the picture.

image


Minimal set of dependencies (third-party extensions)

You will need the latest Mono from http://www.mono-project.com/download/ and the following VSCode extensions:

image

Note, you may need to add Mono to the system path manually if it didn’t happen for you during the Mono installation.


Functionality

  • Editing

    All C# editing support available with VSCode, including Syntax Highlighting, IntelliSense, Go to Definition, Find All References, etc.

  • Debugging

    Debugging support for .NET (Mono and Desktop CLR). This is something that currently is impossible with other extensions.

  • Execution

    All CS-Script features:

    • Direct execution of «plain vanilla» C# files without defining any project infrastructure.
    • You can also execute classless script without entry any point. See auto-class for details.
    • Converting/Building a script into an assembly or a self contained executable.
    • Inclusion of the dependency scripts via CS-Script directives:
      • Importing other C# scripts
      • Referencing assemblies either explicitly or implicitly via automatic resolving namespaces into assemblies
      • Referencing NuGet packages
  • Portability

    The extension is supported on all OSs where VSCode can run.

Road map

Below are the road map highlights only. Some more detailed information are available in the last section of this document.

  • Add support for C# 7 just out of box. (Done in v1.2.0)
  • Add toolbar buttons for most frequent CS-Script commands. (Done in v1.2.0)
  • Adding a custom view (script project tree) containing all script dependencies (e.g. imported scripts, DLLs) (Done in v1.3.0)
  • Integrate CS-Script specific autocompletion with default C# autocompletion (OmniSharp). (Done in v1.3.0)
  • Integrate CS-Script run/debug commands with the default launch actions. (Done in v1.3.0)
  • Allow fallback autocompletion (similar to Sublime Text) when OmniSharp is not activated. (Done in v1.4.0)
  • Full scale Intellisense support (via its own Intellisense services) without loading the folder. (Done in v1.5.0)

C# scripting with VSCode

CS-Script.VSCode allows convenient editing and execution of the C# code directly from the editor. A «C# script» is a file containing any ECMA-compliant C# code. While other C# based runtimes require C# code to be compiled into assemblies CS-Script allows direct C# execution by generating the assemblies on-fly. Thus you don’t need to have any script specific configuration for executing your script. A single script file is fully sufficient as it contains everything that CS-Script needs to know to execute the script.

When your C# script depend on other (source code, assembly or NuGet package) C# modules you can express this in your code in a very simple way via //css_* directives. These directives are conceptually similar to Python import *, which appear on top of the script. CS-Script has only a handful directives that are easy to remember. And of course you can find the complete CS-Script documentation on GigHub: https://github.com/oleg-shilo/cs-script/wiki

The following is the overview of the CS-Script functionality available with VS Code. The overview also highlights the major CS-Script featured:

Note: the most frequently used CS-Script command can also be accessed directly via toolbar buttons without using ‘command palette’:

image

Be aware that apart from allowing typical C# Intellisense this extension also provides C-Script specific code assistance features (mouse hover, go-to-definition and autocompletion) as well as the script project tree CS-SCRIPT- ACTIVE:

image

Usage

Installing

While the extension is published on VSCode marketplace the latest unpublished[releases can be accesses on GitHub releases page.

Executing

Command: cs-script: run

Open the C# file and execute «run» command (Ctrl+F5):

image

Check for syntax errors

Command: cs-script: check

Open the C# file and execute «check» command (F7):

image

Debugging

Command: cs-script: debug

Open the C# file and execute «debug» command (Alt+F5):

Note: you can use standard VSCode debugging triggers (e.g. F5) if you load the script as a workspace. See ‘Load as workspace’ section.

image

Managing Dependencies

Command: cs-script: print project

Open the C# file and execute «print project» command (Alt+F7):

image

Using CS-Script IntelliSense

Command: N/A

Open the C# file and start using normal intellisense triggers with CS-Script specific symbols: hover, go-to-definition, autocompletion, find references.


Please note that CS-Script IntelliSense is only enabled when no workspace loaded. This is done in order to avoid any interference with the standard VSCode Intellisense for workspaces.


image

The supported Intellisense features are:

  1. Suggest completion (autocompletion)
  2. Go to definition
  3. Find all references
  4. Find all references (classic)
  5. Show symbol info as tooltip on mouse over the expression
  6. Format document
  7. Rename symbol
  8. Signature help
  9. Assignment autocomplete

«Find all references (classic)» is an alternative result representation of the standard VSCode «Find all references» for C#, TypeScript and VB.NET code (supported syntaxes can be extended). This presentation in conjunction with a single-click navigation is more consistent with the traditional Visual Studio experience:

image

Load as workspace

Command: cs-script: load project

Open the C# file and execute «load project» command (ctrl+F7)

CS-Script and VSCode are following completely different project paradigm.

  • CS-Script

    A single C#/VB.NET file is self-sufficient. It contains all the information about the dependencies required for execution/editing/debugging the script application:

    • referenced scripts (directly in code)
    • referenced assemblies (directly in code)
    • referenced NuGet packages (directly in code)
    • CS-Script.VSCode Intellisense functionality
  • VSCode

    A project file (*.sprog) and a project folder is required to fully define the dependencies required for execution/editing/debugging the application:

    • referenced scripts (in project file)
    • referenced assemblies (in project file)
    • referenced NuGet packages (in project file)
    • OmniSharp Intellisense functionality

By default, when you just open a C#/VB.NET file the all development activities are handled by the CS-Script extension infrastructure. However sometimes you may prefer to use OmniSharp Intellisense. If it is the case you can open the script file and generate on-fly the all traditional project infrastructure — workspace (project file and folder). This can be achieved by executing the «load project» command (ctrl+F7).

image

VB.NET support

VB.NET support is currently enabled for Windows+Mono hosting only. See the start section of this document about how to enable Mono hosting.

CS-Script supports VB.NET scripts as long as the underlying compiling services (Roslyn) support the syntax. Thus you can execute any VB.NET script by simply loading it into the editor and then executing it the same way as C# scripts.

image

The only limitation to that is that certain Intellisesne features may not work on Linux. And you will need to place break points programmatically (image above) since VSCode does not support VB syntax natively.

Limitations

C# 7

The extension comes with C# 7 support (via Roslyn, which is a part of .NET Core) enabled by default. However Roslyn has an unfortunate limitation — it is extremely heavy and slow on startup. Thus it can take ~3-5 seconds to do the first compilation of a script or an Intellisense request. Any further successive operations do not exhibit any delays.

A good indication of the extension being ready for Intellisense operations is the script project tree being populated and the status bar having «CS-Script ready» message at status bar. Note, the message stays only for 5 seconds:

image

Roslyn team did a good job by caching runtime instances of the compilers thus any consequent compilations will require only milliseconds to be accomplished. Unfortunately on Linux/Mono the same caching mechanism is not available so the compilation will consistently take up to 1.5 seconds (tested on VMWare Mint 18.1 4GB RAM on i7-5500U 2*2.40 GHz). Hopefully Roslyn team will extend runtime caching in the future releases of Mono.

Note, the Roslyn startup delay has no affect on script execution. CS-Script uses application level JIT compilation (similar to Python caching) that avoids compiling scripts if they are not changed since the last execution.

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Cs money ошибка 404
  • Cs go error failed to initialize nvidia driver
  • Delphi reset file error
  • Cryengine error invalid parameter detected in crt function
  • Delphi f250fl code error

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии