formulahendry / formulahendry/vscode-code-runner

.vb files can't be run on Ubuntu/VSCode

Offen
#558 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
2.4k
Forks
351
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

- VSCode environment:
```
Version: 1.39.2
Commit: 6ab598523be7a800d7f3eb4d92d7ab9a66069390
Date: 2019-10-15T15:33:40.634Z
Electron: 4.2.10
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Linux x64 4.15.0-66-generic
```
- Code Runner Version: 0.9.14
- additionally installed packages
* mono 6.4 / mono-devel
* dotnet (.net core)

## Error description
**.vb files can't be run on Ubuntu(Linux) with VSCode**

When trying to start a .vb file on Ubuntu 18.04 with VSCode and CodeRunner, it tryed to start it with following commands and failed
```
[Running] cd "/home/myuser/Desktop/ConsoleTest.NetFramework/" && vbc /nologo main.vb && "/home/myuser/Desktop/ConsoleTest.NetFramework/"main
/bin/sh: 1: /home/myuser/Desktop/ConsoleTest.NetFramework/main: not found

[Done] exited with code=127 in 1.92 seconds
```

* `vbc` compiles to a file filenamewithoutexetion.exe, e.g. a main.vb gets compiled to main.exe => the call command must contain an additional ".exe"
* a next issue is because `vbc` compiles to .NET Framework and requires Mono to be involved. For this, the call command requires a leading `mono ` in front of the path to the exe file

I tested successfully to run my .vb code file with following settings.json on Ubuntu 18.04 LTS with installed Mono 6.4:

## Full settings.json
```json
{
"git.autoStash": true,
"editor.formatOnPaste": true,
"code-runner.executorMapByFileExtension": {
".vb": "cd $dir && vbc /nologo $fileName && mono $dir$fileNameWithoutExt.exe"
},
"files.autoSave": "afterDelay"
}
```

**The most important line here is**
```
".vb": "cd $dir && vbc /nologo $fileName && mono $dir$fileNameWithoutExt.exe"
```

## This is my simple file `main.vb` for test execution:
```vb.net
Public Module Test

Public Sub Main()
System.Console.WriteLine ("Hello World")
System.Console.WriteLine (MyTest.Sum(1,2))
End Sub

End Module
Public Class MyTest

public shared function Sum(a as integer, b as integer) as integer
return a + b
end function

End Class
```

## This is the output of CodeRunner after above changes
```
[Running] cd "/home/myuser/Desktop/ConsoleTest.NetFramework/" && vbc /nologo main.vb && mono "/home/myuser/Desktop/ConsoleTest.NetFramework/"main.exe
Hello World
3

[Done] exited with code=0 in 1.864 seconds
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginne mit dem .vb-Eintrag in settings.json und reproduziere den Fehler mit main.vb auf Ubuntu unter Verwendung von vbc und Mono. Vergleiche den executor command mit dem erfolgreichen executorMapByFileExtension-Beispiel; abgeschlossen ist die Aufgabe, wenn eine .vb-Datei über Code Runner kompiliert und ausgeführt wird und die erwartete Ausgabe sowie exit code 0 erzeugt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
visualbasic, vscode
Bereich
tooling
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.