OmniSharp / omnisharp-atom

Omnisharp support for the atom editor
https://atom.io/packages/omnisharp-atom
MIT License
318 stars 61 forks source link

Uncaught TypeError: Cannot read property 'run' of undefined #1032

Open tushar-mehndiratta-alt opened 6 years ago

tushar-mehndiratta-alt commented 6 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.31.2 x64 Electron: 2.0.7 OS: Microsoft Windows 10 Home Single Language Thrown From: omnisharp-atom package 0.31.2

Stack Trace

Uncaught TypeError: Cannot read property 'run' of undefined

At C:\Users\mshas\.atom\packages\omnisharp-atom\dist\atom\generator-aspnet.js:87

TypeError: Cannot read property 'run' of undefined
    at GeneratorAspnet.run (/packages/omnisharp-atom/dist/atom/generator-aspnet.js:87:35)
    at GeneratorAspnet.newProject (/packages/omnisharp-atom/dist/atom/generator-aspnet.js:78:41)
    at /packages/omnisharp-atom/dist/atom/generator-aspnet.js:42:30)
    at CommandRegistry.handleCommandEvent (~/AppData/Local/atom/app-1.31.2/resources/app/src/command-registry.js:384:49)
    at CommandRegistry.dispatch (~/AppData/Local/atom/app-1.31.2/resources/app/src/command-registry.js:273:23)
    at AtomEnvironment.dispatchApplicationMenuCommand (~/AppData/Local/atom/app-1.31.2/resources/app/src/atom-environment.js:1351:25)
    at EventEmitter.outerCallback (~/AppData/Local/atom/app-1.31.2/resources/app/src/application-delegate.js:311:53)
    at emitThree (events.js:136:13)
    at EventEmitter.emit (events.js:217:7)

Commands

     -1:29.8.0 omnisharp-atom:toggle (input.hidden-input)
     -1:24.1.0 omnisharp-atom:new-project (input.hidden-input)

Non-Core Packages

autocomplete-python 1.10.12 
busy-signal 1.4.3 
file-icons 2.1.25 
gpp-compiler 3.0.7 
highlight-selected 0.14.0 
Hydrogen 2.6.0 
intentions 1.1.5 
kite 0.110.0 
language-cshtml 0.4.2 
linter 2.2.0 
linter-clang 4.1.2 
linter-flake8 2.3.0 
linter-ui-default 1.7.1 
minimap 4.29.9 
minimap-highlight-selected 4.6.1 
omnisharp-atom 0.31.2 
python-autopep8 0.1.3 
script 3.18.1 
script-runner 2.3.1 
Karmylla commented 6 years ago

Getting the same issue

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.31.2 x64 Electron: 2.0.7 OS: Microsoft Windows 10 Home Thrown From: omnisharp-atom package 0.31.2

Stack Trace

Uncaught TypeError: Cannot read property 'run' of undefined

At C:\Users\Karmylla\.atom\packages\omnisharp-atom\dist\atom\generator-aspnet.js:87

TypeError: Cannot read property 'run' of undefined
    at GeneratorAspnet.run (/packages/omnisharp-atom/dist/atom/generator-aspnet.js:87:35)
    at GeneratorAspnet.newProject (/packages/omnisharp-atom/dist/atom/generator-aspnet.js:78:41)
    at /packages/omnisharp-atom/dist/atom/generator-aspnet.js:42:30)
    at CommandRegistry.handleCommandEvent (~/AppData/Local/atom/app-1.31.2/resources/app/src/command-registry.js:384:49)
    at CommandRegistry.dispatch (~/AppData/Local/atom/app-1.31.2/resources/app/src/command-registry.js:273:23)
    at AtomEnvironment.dispatchApplicationMenuCommand (~/AppData/Local/atom/app-1.31.2/resources/app/src/atom-environment.js:1351:25)
    at EventEmitter.outerCallback (~/AppData/Local/atom/app-1.31.2/resources/app/src/application-delegate.js:311:53)
    at emitThree (events.js:136:13)
    at EventEmitter.emit (events.js:217:7)

Commands

     -0:56.5.0 omnisharp-atom:new-project (atom-workspace.workspace.scrollbars-visible-always.theme-one-dark-syntax.theme-one-dark-ui)

Non-Core Packages

atom-beautify 0.33.4 
atom-ide-ui 0.13.0 
atom-live-server 2.3.0 
busy-signal 1.4.3 
emmet 2.4.3 
file-icons 2.1.25 
highlight-selected 0.14.0 
ide-json 0.2.1 
intentions 1.1.5 
ionide-paket 2.2.6 
json-colorer 1.0.0 
json-schema 0.1.15 
language-cshtml 0.4.2 
linter 2.2.0 
linter-ui-default 1.7.1 
omnisharp-atom 0.31.2 
pigments 0.40.2 
pretty-json 2.0.3 
todo 0.6.0 
Ultrahero commented 6 years ago

To solve this go to you .atom directory and locate \packages\omnisharp-atom\dist\atom\generator-aspnet.js There you have to switch the part of "{ key:'run', ...}" (line 84) with the following "{ key:'setup', ...}" (line 90) so that the setup part is above. Then you have to solve another issue but a report with a solution is already online.

I hope this will also work for you.

don01001000 commented 5 years ago

Hi, @Ultrahero. I updated my file to be as follows, and I'm still getting the error, just on the new line number.

}, {
key: 'setup',
    value: function setup(generator) {
        this.generator = generator;
}
}, {
    key: 'run',
    value: function run(command) {
        return this.generator.run(command, undefined, { promptOnZeroDirectories: true });
    }
}, {

Uncaught TypeError: Cannot read property 'run' of undefined /Users/MyUser/.atom/packages/omnisharp-atom/dist/atom/generator-aspnet.js:92

Does the other issue with a report solve this? I got this error after applying the fix for error #1023. I'm on MacOS.

EduardoSantos7 commented 5 years ago

In my case the solution appears after check the python-shell official documentation. 'electron' is correct and be sure to pass run function all the parameters that the function needs (following some tutorials, I was not writting arguments: options) also be sure to write correctly PythonShell

const { app, BrowserWindow } = require('electron')

let { PythonShell } = require('python-shell')

PythonShell.run('hello.py', null, function (err, results) {
    if (err) throw err;
    console.log('hello.py finished.');
    console.log('results', results);
});

Hope be useful!

SpoerlM commented 4 years ago

Any update on this topic so far? Still have this problem under Ubuntu. [Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.43.0 x64 Electron: 4.2.7 OS: Ubuntu 18.04.4 Thrown From: omnisharp-atom package 0.31.2

Stack Trace

Uncaught TypeError: Cannot read property 'run' of undefined

At /home/spoerlm/.atom/packages/omnisharp-atom/dist/atom/generator-aspnet.js:87

TypeError: Cannot read property 'run' of undefined
    at GeneratorAspnet.run (/packages/omnisharp-atom/dist/atom/generator-aspnet.js:87:35)
    at GeneratorAspnet.newProject (/packages/omnisharp-atom/dist/atom/generator-aspnet.js:78:41)
    at /packages/omnisharp-atom/dist/atom/generator-aspnet.js:42:30)
    at CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app/static/<embedded>:11:349290)
    at CommandRegistry.dispatch (/usr/share/atom/resources/app/static/<embedded>:11:347765)
    at AtomEnvironment.dispatchContextMenuCommand (/usr/share/atom/resources/app/static/<embedded>:1:723491)
    at EventEmitter.t (/usr/share/atom/resources/app/static/<embedded>:1:731497)
    at EventEmitter.emit (events.js:182:13)

Commands

Non-Core Packages

atom-beautify 0.33.4 
atom-python-run 0.9.7 
autocomplete-python 1.16.0 
busy-signal 2.0.1 
file-icons 2.1.39 
gpp-compiler 3.0.7 
ide-csharp 0.6.2 
intentions 1.1.5 
linter 2.3.1 
linter-erb 1.1.5 
linter-flake8 2.4.0 
linter-gcc 0.9.0 
linter-ui-default 1.8.1 
minimap 4.29.9 
minimap-cursorline 0.2.0 
minimap-linter 2.2.1 
omnisharp-atom 0.31.2 
project-viewer 1.4.0 
python-autopep8 0.1.3 
rzx-dark-syntax 1.1.1 
rzx-dark-ui 1.1.3