microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.3k stars 28.9k forks source link

[BUG] Changing json file marks it as corrupt #106706

Closed ANF-Studios closed 4 years ago

ANF-Studios commented 4 years ago

Steps to Reproduce:

  1. Create a C++ project
  2. Generate a json files
  3. Change contents of the json file
  4. Run the program
  5. You will then get an error saying that the file type is not recognized

Does this issue occur when all extensions are disabled?: No

sundarrajansr commented 4 years ago

@ANF-Studios Please comment the list of extensions related to JSON in VS code

aeschli commented 4 years ago

Please add a screenshot of the error dialog. Also please run with any extensions. Likely the error is from an extension and an issue need to be filed against the extension.

ANF-Studios commented 4 years ago

@ANF-Studios Please comment the list of extensions related to JSON in VS code

It happens with the C/C++ Extension by Microsoft (ms-vscode.cpptools)

Please add a screenshot of the error dialog.

I copied the terminal and removed some personal details.

> Executing task in folder Project: cl.exe /Zi /EHsc /Fe: 'c:\Users\<Username>\source\VSCode\Project\.vscode\tasks.exe' 'c:\Users\<Username>\source\VSCode\Project\.vscode\tasks.json' <

cl.exe : The term 'cl.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the 
name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ cl.exe /Zi /EHsc /Fe: 'c:\Users\<Username>\source\VSCode\Proj...    
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (cl.exe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command cl.exe /Zi /EHsc /Fe: 'c:\Users\<Username>\source\VSCode\CCPlayground\.vscode\tasks.exe' 'c:\Users\<Username>\source\VSCode\Project\.vscode\tasks.json'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

> Executing task in folder Project: cl.exe /Zi /EHsc /Fe: 'c:\Users\<Username>\source\VSCode\Project\.vscode\tasks.exe' 'c:\Users\<Username>\source\VSCode\Project\.vscode\tasks.json' <

cl.exe : The term 'cl.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the 
name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ cl.exe /Zi /EHsc /Fe: 'c:\Users\<Username>\source\VSCode\Proj...
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (cl.exe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command cl.exe /Zi /EHsc /Fe: 'c:\Users\<Username>\source\VSCode\Project\.vscode\tasks.exe' 'c:\Users\<Username>\source\VSCode\Project\.vscode\tasks.json'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

This showed up when I changed just one thing and then pressed Ctrl + Z, if I change some contents correctly, like the externalConsole argument to true, it won't throw any errors.

Also please run with any extensions. Likely the error is from an extension and an issue need to be filed against the extension.

This doesn't happen when using the C# extension, so I'm pretty sure that this is not me.

ANF-Studios commented 4 years ago

Oh and also, that is what happens when I edit my tasks.json; when I edit my launch.json, I get this:

> Executing task in folder Project: cl.exe /Zi /EHsc /Fe: 'c:\Users\<Username>\source\VSCode\Project\src\Program.exe' 'c:\Users\<Username>\source\VSCode\Project\src\Program.cpp' <

Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29111 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

Program.cpp
Microsoft (R) Incremental Linker Version 14.27.29111.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/debug
"/out:c:\Users\<Username>\source\VSCode\Project\src\Program.exe"
Program.obj

Terminal will be reused by tasks, press any key to close it.

> Executing task in folder Project: cl.exe /Zi /EHsc /Fe: 'c:\Users\<Username>\source\VSCode\Project\.vscode\launch.exe' 'c:\Users\<Username>\source\VSCode\Project\.vscode\launch.json' <

Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29111 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

cl : Command line warning D9024 : unrecognized source file type 'c:\Users\<Username>\source\VSCode\Project\.vscode\launch.json', object 
file assumed
Microsoft (R) Incremental Linker Version 14.27.29111.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/debug
"/out:c:\Users\<Username>\source\VSCode\Project\.vscode\launch.exe"
"c:\Users\<Username>\source\VSCode\Project\.vscode\launch.json"
c:\Users\<Username>\source\VSCode\Project\.vscode\launch.json : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2D5      
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command cl.exe /Zi /EHsc /Fe: 'c:\Users\<Username>\source\VSCode\Project\.vscode\launch.exe' 'c:\Users\<Username>\source\VSCode\Project\.vscode\launch.json'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

Which is weird, but for some reason, it happens.

aeschli commented 4 years ago

Can you file it against the C++ extension? https://github.com/microsoft/vscode-cpptools/issues

ANF-Studios commented 4 years ago

Sure, awesome thanks 👍