formulahendry / formulahendry/vscode-code-runner

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

Open
#558 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.4k
Forks
351
PR merge metrics
No merged PRs in 30d

Description

- 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
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.