Issue Id: 04611604-cb83-5e5d-d74d-035e57007c47
Versions
- 1.17.2
Stack
TypeError: Cannot read property 'value' of null
/vs/workbench/services/extensions/electron-browser/extensionService.ts#L246:16 (value)
/vs/base/common/winjs.base.raw.js#L1566:0 (onComplete)
/vs/workbench/services/extensions/electron-browser/extensionService.ts#L245:41 (then)
/vs/workbench/services/extensions/electron-browser/extensionService.ts#L230:15 (_activateByEvent)
/vs/platform/commands/common/commandService.ts#L36:44 (activateByEvent)
/vs/editor/browser/view/viewController.ts#L73:22 (executeCommand)
/vs/editor/browser/controller/textAreaHandler.ts#L219:25 (type)
/vs/base/common/callbackList.ts#L36:22 (apply)
/vs/base/common/event.ts#L123:26 (call)
/vs/editor/browser/controller/textAreaInput.ts#L252:18 (fire)
I have this problem right now,it says: "Cannot read property value of null", and I can't edit anything in the code editor, I don't know what is happening, help please!!
same here, can't enter anything, but copy & paste and delete work just fine. Disabling all extensions doesn't solve the issue
@damasofc @CharryWu Do you have any reproducible steps? Do you see any additional errors in the developer console (Help > Toggle Developer Tools) ?
Also got this problem, was pasting some stuff, and then I could not edit the file.
If I close code down, i can open a new file, and for a very short time it allows me to write stuff (holding down a key while it loads writes ~6 chars)
When i press a key i get this in the developer console:
errors.ts:51 WARNING: Promise with no error callback:170
errors.ts:52 Object {exception: TypeError: Cannot read property 'value' of null
at file:///C:/Program Files/Microsoft VS Code/re…, error: null, promise: n.C…s.d…e.supportedForProcessing, handler: undefined, id: 170…}error: nullexception: TypeError: Cannot read property 'value' of null
at file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:29:25654
at n.Class.derive._creator.then (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:28:60387)
at e._activateByEvent (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:29:25629)
at e.activateByEvent (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:29:25317)
at t.executeCommand (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:28:1080233)
at e.type (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:28:1291328)
at file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:28:1530408
at e.invoke (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:28:67540)
at e.fire (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:28:69263)
at HTMLTextAreaElement.<anonymous> (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:28:391462)handler: undefinedid: 170parent: undefinedpromise: n.Class.derive.supportedForProcessing__proto__: Object
errors.ts:54 TypeError: Cannot read property 'value' of null
at extensionService.ts:246
at n.Class.derive._creator.then (winjs.base.raw.js:1566)
at e._activateByEvent (extensionService.ts:245)
at e.activateByEvent (extensionService.ts:230)
at t.executeCommand (commandService.ts:36)
at e.type (viewController.ts:73)
at textAreaHandler.ts:219
at e.invoke (callbackList.ts:36)
at e.fire (event.ts:123)
at HTMLTextAreaElement.<anonymous> (textAreaInput.ts:252)
@jonhenneberg I got similar error messages from the dev console. I have just figured out it is the C/C++ extension that caused the problem. If I disable the C/C++ extension vscode works again. Try disabling any extensions that do code linting
@CharryWu Thanks, disabling the C/C++ extension seemed to solve it.
Would note that my Code instances are still acting strange thou. After startup it consumes 2G ram, and is very sluggish. Helps to run a garbage collect in the dev tools, then it lowers to 500M of ram.
Tried disabling all plug-ins, did not affect that in the slightest.
Thanks, disabling that extension, solve it
Excuse me, but this is an error of the extension or of VSCode? Beacuse I need that extension to do debugging, and right now I can't do it.
Microsoft/vscode-cpptools#1215
Same problem here. At startup Code eats up to 3 GB of RAM. Only disabling C/C++ extension makes editor responsive again.
I ended up completely removing Code, including settings and extension folders. And installing a clean version. Then the issue with high Load / Ram usage was gone, and i could apply my settings again + install the extensions (incl. C/C++) and everything works as great again.
If anyone is currently seeing this issue, can you please enable our development logging for the cpptools extension to see if it is receiving any messages from VS Code or not. In your settings, please add "C_Cpp.loggingLevel": "6". Ignore the squiggle in your settings.json file. This is an undocumented option.
When this setting is enabled, we will print out all messages received from the VS Code protocol in the Output Window under the "C/C++" channel. In particular, you should look for textDocument/didChange. If these messages are not appearing, then VS Code is not sending our extension any information about your edits. I highly suspect this is a VS Code issue because extensions do not have the capability to intercept keystrokes. We have to be notified about them by VS Code.
@bobbrow
The problem here is that the extension host process crashes / quits unexpectedly, in the initialiaztion phase AFAICT. Most of the reports claim that disabling the C++ extension leads to the extension host process not crashing.
I will add some logging to VSCode around extension activation code to be able to track this down in our upcoming release.
@alexandrudima, so has VS Code even attempted to load our extension at this point? Looking at the code where the crash happens it looks like our extension hasn't even been activated yet which means that none of our extension's code would have run yet (unless I'm reading it wrong).
@bobbrow I 100% do not understand what you're talking about. The stack trace present in this error telemetry issue occurs on the renderer process, as a direct result of the extension host process crashing in the initialization path.
In other words, I can avoid this specific stack trace by checking for a null pointer, but the root cause of this error is that the extension host crashes very early in its lifecycle, most likely when activating eager (* and workspaceContains:) extensions.
I know nothing about how VS Code initializes extensions. All I know is that at some point VS Code calls our "activate" method and passes in an ExtensionContext and at that point we are "active". The code at the crash site looks like this:
protected _activateByEvent(activationEvent: string): TPromise<void> {
if (this._extensionHostProcessFinishedActivateEvents[activationEvent] || !this._extensionHostProcessProxy) {
return NO_OP_VOID_PROMISE;
}
return this._extensionHostProcessProxy.then((proxy) => {
return proxy.value.$activateByEvent(activationEvent); // <-- crash here
}).then(() => {
this._extensionHostProcessFinishedActivateEvents[activationEvent] = true;
});
}
I don't know what $activateByEvent is, but it looks like VS Code is still working with an activationEvent string, not an ExtensionContext which made me think that VS Code had not passed us the context yet. So this reads to me like our extension's code has not been loaded or executed by VS Code yet. Are you saying that our extension has already begun execution? Like I said, I don't pretend to know what this code is doing. I'm just asking if our extension's activate method has already been called at this point.
@bobbrow VS Code is a multi-process tool. The UI of VS Code executes in what we call a renderer process. VS Code spawns a separate process, which we call the extension host process. Source code from extensions is loaded and executes in this separate process.
To facilitate programming through a message-passing IPC protocol, we have built a proxy infrastructure to make talking between processes look like method calls. The above source code that you show will execute on the renderer process. proxy.value.$activateByEvent will send a message to the extension host and ask it that it activates all the extensions that depend on an activation event.
But proxy is null. It is null because the extension host process crashes in its initialization phase. The initialization phase includes ... initialization ... and activation of eager extensions. Eager extensions are the ones that activate on * or workspaceContains:.
I do not have definite proof that the crash occurs due to the C++ extension, but the reports from users who disable it make me believe the activation path of the C++ extension may lead to a crash of the extension host. The easiest type of crash it could cause would be an OOM crash.
For November, I have pushed code that logs to our brand new logging infrastructure. Once we ship the November stable release of VS Code, I will ping folks involved in this thread to enable tracing and try to reproduce the crash. Then, we can collect the extension host process log and see, together, how far in the initialization path, the extension host process made it before it crashed. Hopefully, that gives us sufficient information to be able to pinpoint the root cause.
Thanks for the explanation. That makes sense.
There is no clear root cause here and no clear code change that can be done in VS Code. This error is a result of another error. i.e.
It means the extension host process crashed, but does not identify why it has crashed (the root cause). I will close, as the issue is not actionable...
Most helpful comment
I have this problem right now,it says: "Cannot read property value of null", and I can't edit anything in the code editor, I don't know what is happening, help please!!