vscode-powershell icon indicating copy to clipboard operation
vscode-powershell copied to clipboard

VS Code\PowerShell - "Formatting Document" Long Execution Time

Open RickFlist opened this issue 9 years ago • 30 comments

System Details

  • Operating system name and version: Windows 10 Ent x64
  • VS Code version: 1.14.2 (Latest)
  • PowerShell extension version: 1.4.1 (Latest)
  • Output from $PSVersionTable:

Name Value


PSVersion 5.1.15063.483
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.15063.483
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Copy / paste the following commands into the PowerShell Integrated Console, and paste the output here:

code -v 1.14.2 cb82febafda0c8c199b9201ad274e25d9a76874e

$pseditor.EditorServicesVersion Major Minor Build Revision


1 4 1 0

code --list-extensions --show-versions [email protected]

$PSVersionTable v-toddle.microsoft.com.zip Name Value


PSVersion 5.1.15063.483
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.15063.483
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Issue Description

Hello! I posted this to VS Code and they referred me here (https://github.com/Microsoft/vscode/issues/31985#issuecomment-320095822)

I've noticed over the last couple days/week that VS Code is taking a very long time on "Formatting Document". I have my VS Code instance configured to format the document on every save, and I save constantly, so this is a real PITA. :( I have attached the contents of $env:APPDATA\Code\User to this report.

Steps to Reproduce

Steps to Reproduce:

Configure VS Code using my settings.json Open up any Posh Script. I have encountered this on scripts with as few as 120 lines Make a change Save file Blue bar at bottom of VS Code states "Formatting Document". VS Code is responsive, but Snippets and Intellisense do not function until it completes doing whatever it was doing. Reproduces without extensions: No

Attached Logs

v-toddle.microsoft.com.zip

Follow the instructions in the README about capturing and sending logs.

RickFlist avatar Aug 04 '17 15:08 RickFlist

Actually now that I read this, I see you mention that it happens even on short scripts. Is it consistently slow even when you open up a fresh VS Code session and try it?

daviwil avatar Aug 14 '17 22:08 daviwil

It does NOT repro if I launch code with the --disable-extensions parameter. Otherwise, it repros every single time, seemingly regardless of what extensions I have installed or the size of the script or the freshness of the session

RickFlist avatar Aug 14 '17 23:08 RickFlist

This issue is caused by the PowerShell extension, so that's really the only thing that matters in this case. I'll take a look at your logs tomorrow and let you know if there's anything you can try to narrow down the source of the issue.

daviwil avatar Aug 14 '17 23:08 daviwil

Thanks. Not being able to use Snippets has really slowed me down. :\

RickFlist avatar Aug 15 '17 15:08 RickFlist

I also just noticed that CTRL+SHIFT+O does not list all the functions in a module as well. I verified integrated terminal started and even killed and and restarted it. CTRL+SHIFT+O states "no symbol information found"

RickFlist avatar Aug 15 '17 19:08 RickFlist

FYI, while working on something I accidentally moved my powershell.json snippets file. This resolved the performance issues.

RickFlist avatar Aug 16 '17 16:08 RickFlist

@kapilmb will look into this for the next release

daviwil avatar Aug 18 '17 16:08 daviwil

The snippets file was a red herring, after about 30 minutes the perf issues came back. Is there a workaround? Not having intellisense is very annoying

RickFlist avatar Aug 18 '17 17:08 RickFlist

You could try turning off PSScriptAnalyzer in your settings:

"powershell.scriptAnalysis.enable": false

daviwil avatar Aug 18 '17 17:08 daviwil

That seems to work. Thank you so much.

RickFlist avatar Aug 18 '17 17:08 RickFlist

Fudge. It's back.

RickFlist avatar Aug 18 '17 17:08 RickFlist

@RickFlist There is a good chance that the formatter is crashing, which is causing the problem. There are a few situations I can think of that that can cause it to crash but would like to know for sure what is causing the problem on your side.

Would it be possible for you to share the document on which this is happening so that I can find out the exact issue? Thanks!

kapilmb avatar Aug 19 '17 17:08 kapilmb

It literally happens in everything. I can open a new document and start typing, and intellisense fails

RickFlist avatar Aug 19 '17 17:08 RickFlist

It literally happens in everything

This is very strange. I see that the zip file you have attached does not contain the logs. Can you please try sending me the logs again for the instance when you encounter the issue? (Steps for sending logs here: https://github.com/PowerShell/vscode-powershell#reporting-problems). Thanks.

kapilmb avatar Aug 19 '17 17:08 kapilmb

yup. won't be until EOD Monday probably

RickFlist avatar Aug 19 '17 18:08 RickFlist

I checked and editorServicesLogLevel was already set to verbose. So I looked in the logs folder and still have logs from the time when I submitted the original issue, plus logs from the interim. Hopefully there is a plethora of information contained therein

[email protected][2017-08-09 to 2017-08-21].zip

RickFlist avatar Aug 21 '17 20:08 RickFlist

Thanks Todd. What did you use to create the ZIP file? I actually get two different sets of files when I open it with different ZIP tools on Windows and Linux.

daviwil avatar Aug 21 '17 20:08 daviwil

7-Zip, but it should have created a standard zip archive? I re-created the archive using Windows (not 7zip) and I have attached both archives again with names indicating what created the archive (tail of filename)

[email protected][2017-08-09 to 2017-08-21]-WindowsZip.zip [email protected][2017-08-09 to 2017-08-21]-7zip.zip

RickFlist avatar Aug 21 '17 20:08 RickFlist

Here's what should be in the .zip

FullName Length


C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502296501-86693425-df14-4011-a748-15b3e06ad11a1502296496291
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502394705-d7db7f59-1b60-40f0-aadb-b650407da0de1502394704311
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502484190-674856ff-0263-4032-aed6-600be03467fb1502483586258
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502729019-3661bb32-d60b-4946-8200-f3202add6fe31502729005801
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502729786-77e7e0cc-86b1-4a67-8b6e-623c158ea48b1502729274342
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502738484-3ea3e7d8-3c86-46fa-9f67-6df6864dab911502738476677
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502738492-fa5a9c5b-610d-406f-b698-65fca94966521502738487585
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502748351-a5075c32-a52a-46b6-9cae-b856667d63561502747978645
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502809109-b3285ce6-7d0d-46d6-9262-a74445c796491502809097513
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502814149-a38ea32c-383d-4a25-93f7-f826e9f2566f1502814130335
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502815008-a62dbffb-c1df-4716-9555-d3324104bdfb1502814988603
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502819534-79e7a89c-ec09-4ed3-9ad6-2614ffff028b1502819519663
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502820143-428024c6-d3ff-4903-bd60-785b4d2a00161502820133071
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502821288-2c800ad1-af08-4565-9a2b-871e060652e81502821274934
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502821526-078cd967-2fee-403f-b813-4a07ac36f4c31502821524119
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502900559-b62167d6-5dc5-4385-b5f4-7f63f493f63c1502900557367
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502902671-c934413e-06b9-4863-a438-f155b9e5879b1502902668890
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502921031-8660bf29-d0a8-4b39-9efe-c39d887656641502921019209
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502987218-8a29469c-6a1a-4fc0-bb5c-5a9c940f9d121502985992310
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1503076923-8a29469c-6a1a-4fc0-bb5c-5a9c940f9d121502985992310
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1503083033-98fd55e4-ddf2-46a6-9225-82831f9366cb1503083023978
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1503345146-6d02d1b5-7466-46bf-9651-1d74977141931503343022917
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1503345804-6689e193-7e9d-45dc-b4c3-6aea7230ab771503345801616
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\[email protected][2017-08-09 to 2017-08-21]-7zip.zip 1077729 C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\[email protected][2017-08-09 to 2017-08-21]-WindowsZip.zip 1096329 C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502296501-86693425-df14-4011-a748-15b3e06ad11a1502296496291\EditorServices.log 10068396 C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502296501-86693425-df14-4011-a748-15b3e06ad11a1502296496291\vscode-powershell.log 1188
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502394705-d7db7f59-1b60-40f0-aadb-b650407da0de1502394704311\EditorServices.log 94372
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502394705-d7db7f59-1b60-40f0-aadb-b650407da0de1502394704311\vscode-powershell.log 1193
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502484190-674856ff-0263-4032-aed6-600be03467fb1502483586258\EditorServices.log 138582
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502484190-674856ff-0263-4032-aed6-600be03467fb1502483586258\vscode-powershell.log 1193
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502729019-3661bb32-d60b-4946-8200-f3202add6fe31502729005801\EditorServices.log 2310
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502729019-3661bb32-d60b-4946-8200-f3202add6fe31502729005801\vscode-powershell.log 1172
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502729786-77e7e0cc-86b1-4a67-8b6e-623c158ea48b1502729274342\EditorServices.log 1675203 C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502729786-77e7e0cc-86b1-4a67-8b6e-623c158ea48b1502729274342\vscode-powershell.log 1190
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502738484-3ea3e7d8-3c86-46fa-9f67-6df6864dab911502738476677\vscode-powershell.log 115
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502738492-fa5a9c5b-610d-406f-b698-65fca94966521502738487585\EditorServices.log 1095202 C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502738492-fa5a9c5b-610d-406f-b698-65fca94966521502738487585\vscode-powershell.log 1171
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502748351-a5075c32-a52a-46b6-9cae-b856667d63561502747978645\EditorServices.log 134210
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502748351-a5075c32-a52a-46b6-9cae-b856667d63561502747978645\vscode-powershell.log 1189
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502809109-b3285ce6-7d0d-46d6-9262-a74445c796491502809097513\EditorServices.log 822171
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502809109-b3285ce6-7d0d-46d6-9262-a74445c796491502809097513\vscode-powershell.log 1190
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502814149-a38ea32c-383d-4a25-93f7-f826e9f2566f1502814130335\EditorServices.log 27322
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502814149-a38ea32c-383d-4a25-93f7-f826e9f2566f1502814130335\vscode-powershell.log 1189
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502815008-a62dbffb-c1df-4716-9555-d3324104bdfb1502814988603\EditorServices.log 1259173 C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502815008-a62dbffb-c1df-4716-9555-d3324104bdfb1502814988603\vscode-powershell.log 1189
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502819534-79e7a89c-ec09-4ed3-9ad6-2614ffff028b1502819519663\EditorServices.log 18109
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502819534-79e7a89c-ec09-4ed3-9ad6-2614ffff028b1502819519663\vscode-powershell.log 1097
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502820143-428024c6-d3ff-4903-bd60-785b4d2a00161502820133071\EditorServices.log 31765
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502820143-428024c6-d3ff-4903-bd60-785b4d2a00161502820133071\vscode-powershell.log 1189
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502821288-2c800ad1-af08-4565-9a2b-871e060652e81502821274934\EditorServices.log 99549
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502821288-2c800ad1-af08-4565-9a2b-871e060652e81502821274934\vscode-powershell.log 1191
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502821526-078cd967-2fee-403f-b813-4a07ac36f4c31502821524119\EditorServices.log 2620708 C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502821526-078cd967-2fee-403f-b813-4a07ac36f4c31502821524119\vscode-powershell.log 1191
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943\EditorServices.log 5181630 C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943\vscode-powershell.log 1188
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502900559-b62167d6-5dc5-4385-b5f4-7f63f493f63c1502900557367\EditorServices.log 14135
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502900559-b62167d6-5dc5-4385-b5f4-7f63f493f63c1502900557367\vscode-powershell.log 1190
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502902671-c934413e-06b9-4863-a438-f155b9e5879b1502902668890\EditorServices.log 15712722 C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502902671-c934413e-06b9-4863-a438-f155b9e5879b1502902668890\vscode-powershell.log 1189
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502921031-8660bf29-d0a8-4b39-9efe-c39d887656641502921019209\EditorServices.log 187773
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502921031-8660bf29-d0a8-4b39-9efe-c39d887656641502921019209\vscode-powershell.log 1189
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502987218-8a29469c-6a1a-4fc0-bb5c-5a9c940f9d121502985992310\EditorServices.log 4677096 C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1502987218-8a29469c-6a1a-4fc0-bb5c-5a9c940f9d121502985992310\vscode-powershell.log 1188
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1503076923-8a29469c-6a1a-4fc0-bb5c-5a9c940f9d121502985992310\EditorServices.log 641109
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1503076923-8a29469c-6a1a-4fc0-bb5c-5a9c940f9d121502985992310\vscode-powershell.log 1169
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1503083033-98fd55e4-ddf2-46a6-9225-82831f9366cb1503083023978\EditorServices.log 16936
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1503083033-98fd55e4-ddf2-46a6-9225-82831f9366cb1503083023978\vscode-powershell.log 1188
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1503345146-6d02d1b5-7466-46bf-9651-1d74977141931503343022917\EditorServices.log 84865
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1503345146-6d02d1b5-7466-46bf-9651-1d74977141931503343022917\vscode-powershell.log 1171
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1503345804-6689e193-7e9d-45dc-b4c3-6aea7230ab771503345801616\EditorServices.log 77428
C:\Users\v-toddle.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1503345804-6689e193-7e9d-45dc-b4c3-6aea7230ab771503345801616\vscode-powershell.log 1093

RickFlist avatar Aug 21 '17 20:08 RickFlist

I looked through the logs that you attached, and I cannot find anything wrong with the formatter just through the logs:

PS> find *.log | sls textDocument/.*format

1502296501-86693425-df14-4011-a748-15b3e06ad11a1502296496291\EditorServices.log:5341:    Received Request 'textDocument/rangeFormatting' with id 174
1502296501-86693425-df14-4011-a748-15b3e06ad11a1502296496291\EditorServices.log:5349:    Writing Response 'textDocument/rangeFormatting' with id 174
1502296501-86693425-df14-4011-a748-15b3e06ad11a1502296496291\EditorServices.log:10490:    Received Request 'textDocument/rangeFormatting' with id 368
1502296501-86693425-df14-4011-a748-15b3e06ad11a1502296496291\EditorServices.log:10498:    Writing Response 'textDocument/rangeFormatting' with id 368
1502484190-674856ff-0263-4032-aed6-600be03467fb1502483586258\EditorServices.log:1104:    Received Request 'textDocument/rangeFormatting' with id 41
1502484190-674856ff-0263-4032-aed6-600be03467fb1502483586258\EditorServices.log:1112:    Writing Response 'textDocument/rangeFormatting' with id 41
1502729786-77e7e0cc-86b1-4a67-8b6e-623c158ea48b1502729274342\EditorServices.log:1568:    Received Request 'textDocument/rangeFormatting' with id 50
1502729786-77e7e0cc-86b1-4a67-8b6e-623c158ea48b1502729274342\EditorServices.log:1576:    Writing Response 'textDocument/rangeFormatting' with id 50
1502738492-fa5a9c5b-610d-406f-b698-65fca94966521502738487585\EditorServices.log:5963:    Received Request 'textDocument/rangeFormatting' with id 282
1502738492-fa5a9c5b-610d-406f-b698-65fca94966521502738487585\EditorServices.log:5971:    Writing Response 'textDocument/rangeFormatting' with id 282
1502738492-fa5a9c5b-610d-406f-b698-65fca94966521502738487585\EditorServices.log:12026:    Received Request 'textDocument/rangeFormatting' with id 560
1502738492-fa5a9c5b-610d-406f-b698-65fca94966521502738487585\EditorServices.log:12034:    Writing Response 'textDocument/rangeFormatting' with id 560
1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943\EditorServices.log:330:    Received Request 'textDocument/rangeFormatting' with id 5
1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943\EditorServices.log:338:    Writing Response 'textDocument/rangeFormatting' with id 5
1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943\EditorServices.log:1351:    Received Request 'textDocument/rangeFormatting' with id 45
1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943\EditorServices.log:1359:    Writing Response 'textDocument/rangeFormatting' with id 45
1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943\EditorServices.log:9090:    Received Request 'textDocument/rangeFormatting' with id 345
1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943\EditorServices.log:9098:    Writing Response 'textDocument/rangeFormatting' with id 345
1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943\EditorServices.log:9298:    Received Request 'textDocument/rangeFormatting' with id 349
1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943\EditorServices.log:9306:    Writing Response 'textDocument/rangeFormatting' with id 349
1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943\EditorServices.log:9965:    Received Request 'textDocument/rangeFormatting' with id 378
1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943\EditorServices.log:9973:    Writing Response 'textDocument/rangeFormatting' with id 378
1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943\EditorServices.log:10363:    Received Request 'textDocument/rangeFormatting' with id 389
1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943\EditorServices.log:10371:    Writing Response 'textDocument/rangeFormatting' with id 389
1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943\EditorServices.log:87037:    Received Request 'textDocument/rangeFormatting' with id 3167
1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943\EditorServices.log:87045:    Writing Response 'textDocument/rangeFormatting' with id 3167
1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943\EditorServices.log:90576:    Received Request 'textDocument/rangeFormatting' with id 3272
1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943\EditorServices.log:90584:    Writing Response 'textDocument/rangeFormatting' with id 3272
1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943\EditorServices.log:90632:    Received Request 'textDocument/rangeFormatting' with id 3275
1502834407-cc2b2004-936c-44f1-8a61-12a94f7c1a791502834404943\EditorServices.log:90640:    Writing Response 'textDocument/rangeFormatting' with id 3275
1502902671-c934413e-06b9-4863-a438-f155b9e5879b1502902668890\EditorServices.log:470:    Received Request 'textDocument/rangeFormatting' with id 14
1502902671-c934413e-06b9-4863-a438-f155b9e5879b1502902668890\EditorServices.log:478:    Writing Response 'textDocument/rangeFormatting' with id 14
1502902671-c934413e-06b9-4863-a438-f155b9e5879b1502902668890\EditorServices.log:1395:    Received Request 'textDocument/rangeFormatting' with id 43
1502902671-c934413e-06b9-4863-a438-f155b9e5879b1502902668890\EditorServices.log:1403:    Writing Response 'textDocument/rangeFormatting' with id 43
1502902671-c934413e-06b9-4863-a438-f155b9e5879b1502902668890\EditorServices.log:2658:    Received Request 'textDocument/rangeFormatting' with id 85
1502902671-c934413e-06b9-4863-a438-f155b9e5879b1502902668890\EditorServices.log:2666:    Writing Response 'textDocument/rangeFormatting' with id 85
1502902671-c934413e-06b9-4863-a438-f155b9e5879b1502902668890\EditorServices.log:2877:    Received Request 'textDocument/rangeFormatting' with id 98
1502902671-c934413e-06b9-4863-a438-f155b9e5879b1502902668890\EditorServices.log:2885:    Writing Response 'textDocument/rangeFormatting' with id 98
1502902671-c934413e-06b9-4863-a438-f155b9e5879b1502902668890\EditorServices.log:4339:    Received Request 'textDocument/rangeFormatting' with id 145
1502902671-c934413e-06b9-4863-a438-f155b9e5879b1502902668890\EditorServices.log:4347:    Writing Response 'textDocument/rangeFormatting' with id 145
1502902671-c934413e-06b9-4863-a438-f155b9e5879b1502902668890\EditorServices.log:4644:    Received Request 'textDocument/rangeFormatting' with id 157
1502902671-c934413e-06b9-4863-a438-f155b9e5879b1502902668890\EditorServices.log:4652:    Writing Response 'textDocument/rangeFormatting' with id 157
1502902671-c934413e-06b9-4863-a438-f155b9e5879b1502902668890\EditorServices.log:6569:    Received Request 'textDocument/rangeFormatting' with id 226
1502902671-c934413e-06b9-4863-a438-f155b9e5879b1502902668890\EditorServices.log:6582:    Writing Response 'textDocument/rangeFormatting' with id 226
1502902671-c934413e-06b9-4863-a438-f155b9e5879b1502902668890\EditorServices.log:6906:    Received Request 'textDocument/rangeFormatting' with id 240
1502902671-c934413e-06b9-4863-a438-f155b9e5879b1502902668890\EditorServices.log:6914:    Writing Response 'textDocument/rangeFormatting' with id 240
1502987218-8a29469c-6a1a-4fc0-bb5c-5a9c940f9d121502985992310\EditorServices.log:5672:    Received Request 'textDocument/rangeFormatting' with id 82
1502987218-8a29469c-6a1a-4fc0-bb5c-5a9c940f9d121502985992310\EditorServices.log:5680:    Writing Response 'textDocument/rangeFormatting' with id 82
1502987218-8a29469c-6a1a-4fc0-bb5c-5a9c940f9d121502985992310\EditorServices.log:48622:    Received Request 'textDocument/rangeFormatting' with id 1707
1502987218-8a29469c-6a1a-4fc0-bb5c-5a9c940f9d121502985992310\EditorServices.log:48630:    Writing Response 'textDocument/rangeFormatting' with id 1707
1503076923-8a29469c-6a1a-4fc0-bb5c-5a9c940f9d121502985992310\EditorServices.log:2408:    Received Request 'textDocument/rangeFormatting' with id 94
1503076923-8a29469c-6a1a-4fc0-bb5c-5a9c940f9d121502985992310\EditorServices.log:2416:    Writing Response 'textDocument/rangeFormatting' with id 94

It seems all the formatting requests are honored by the server, and it is not clear why the formatting powershell document... should stay stuck in the status bar.

My initial hunch was that the formatter crashed, but the only crash at the server appears only in one log file:

    ProtocolEndpoint message loop terminated due to unhandled exception:
    
    System.AggregateException: One or more errors occurred. ---> System.IO.FileNotFoundException: Could not find file 'd:\Source\MAX-CPub-Lab\QuickStart\SQL-SAO-SQL2014SP2-WS2012R2\dsc\MicrosoftAzure_xSqlLogin.psm1'.
       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
       at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost)
       at System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost)
       at Microsoft.PowerShell.EditorServices.LanguageService.<FindReferencesOfSymbol>d__18.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.CodeLenses.ReferencesCodeLensProvider.<ResolveCodeLensAsync>d__4.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.CodeLenses.CodeLensFeature.<HandleCodeLensResolveRequest>d__6.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>d__7.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.<ListenForMessages>d__36.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc, ILogger logger)
       at System.Threading.Tasks.Task.Execute()
       --- End of inner exception stack trace ---
    ---> (Inner Exception #0) System.IO.FileNotFoundException: Could not find file 'd:\Source\MAX-CPub-Lab\QuickStart\SQL-SAO-SQL2014SP2-WS2012R2\dsc\MicrosoftAzure_xSqlLogin.psm1'.
    File name: 'd:\Source\MAX-CPub-Lab\QuickStart\SQL-SAO-SQL2014SP2-WS2012R2\dsc\MicrosoftAzure_xSqlLogin.psm1'
       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
       at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost)
       at System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost)
       at Microsoft.PowerShell.EditorServices.LanguageService.<FindReferencesOfSymbol>d__18.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.CodeLenses.ReferencesCodeLensProvider.<ResolveCodeLensAsync>d__4.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.CodeLenses.CodeLensFeature.<HandleCodeLensResolveRequest>d__6.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>d__7.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.<ListenForMessages>d__36.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc, ILogger logger)
       at System.Threading.Tasks.Task.Execute()<---
    

8/18/2017 10:21:57 AM [ERROR] - Method "ProtocolEndpoint_UnhandledException" at line 417 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Host\EditorServicesHost.cs

    PowerShell Editor Services is terminating due to an unhandled exception, see previous logs for details.

Is there anything else that you can provide me to solve this issue? Any file to repro the issue would be great.

kapilmb avatar Aug 21 '17 22:08 kapilmb