Update Caused Instability?

Issue #39 resolved
Shaun B created an issue

Visual Studio 2017 Enterprise Version 15.9.4 PostTools Version 4.1.0 $PSVersionTable:

[18.11P][E:|40]>> $PSVersionTable

Name Value ---- ----- PSVersion 5.1.17134.407 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.17134.407 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1

Overnight my Poshtools Pro updated itself. In doing such, I started getting VS errors. I mistakenly chose the option to roll back the update. Doing that broke the extensions & updates program in VS. Using the manual install cleaner tool in VS, I was able to get in and reinstall VS 2017 as Enterprise.

Now when I launch a solution. I can make some changes and run a build successfully one time. If I close the app and go back to editing, the color formatting starts changing the colors randomly, see attachment. If I launch the app again, it shows the build as successful, but never gets any further than that. If I close VS and reopen, it will launch one more time successfully.

Note that the color formatting isn't functioning even on the fresh restart of VS.

Comments (30)

  1. Adam Driscoll

    Could you please upgrade to 4.1.1? There were some issues loading the package asynchronously that would cause it to fail to load the services on startup.

  2. pju

    It may not be the same issue but I'm randomly seeing some of the same on 4.1.1. For me restating VS has till now fixed the problem. It seems to me that it goes deeper than just recoloring. I had trouble setting a breakpoint on a line which was colored like a comment. A <# … #> above the line seemed to overflow. Also for instance "Write-Output" had one color for "Write" and another for "Output". Can it be because poshtools crashes? And where can I look for that? Unfortunately I do not know how to reproduce. It just happens from time to time :-( I have never seen it before upgrading to 4.1.1. But, that said, I at the same time updated Win10 to 180914.

    VS Communty 2017 - Version 15.9.4.

    $PSVersionTable PSVersion 5.1.17763.134 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.17763.134 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1

  3. Adam Driscoll

    Attached is the 4.0.5 version if you would like to roll back for the time being. I've reproduced this issue. It's still a timing issue while the extension is loading.

  4. Adam Driscoll

    I've attached a 4.1.2 build that resolves the package initialization issues. It's been tested in the same enviroments that were having issues with 4.1.1 and seems to resolve the issues. If you have some time could you please see if it resolves the issue for you as well?

  5. Adam Driscoll

    I attached the VSIX to this issue. I will upload it to VS Marketplace soon. Just wanted to verify that it resolved your issue.

  6. Shaun B reporter

    Sorry, i see how bitbucket does their attachments now. Installed 4.1.2. The first main ps1 is not color formatted and doesn't format when typing, but other ps1s in the project do, and handle the color coding appropriately.

    With this i have to still close VS after the first time running the app. Subsequent times will build successfully, but won't launch.

  7. pju

    Works fine for me. But - so did 4.1.1 most of the time :-) Anyway - thanks a lot for the fast response - great support!

  8. Adam Driscoll

    Ok. Sounds like it's getting closer. ;)

    If you close the first PS1 that is opened and then reopen it does it resolve the color formatting?

    For the debugging, I will have to look into that more. I'm not sure why it would fail the second time. Are you using a PowerShell Project or using the Open Folder debugging?

  9. pju

    Sigh, tried to open another solution. In which the ps1 file comes up in black and white. And psm1 file is colored as wanted...

    psm1 file, working.jpgps1 file, not working.jpg

  10. pju

    It was not clear, but I: - opened 1 solution: OK - went to File->Recent projects and solutions and chose a solution Which had the above problem. So I did not restart VS in between. Also debugging is not possible in the B/W window.

  11. Adam Driscoll

    Same question, if you close and reopen that PS1 file, does it kick the coloring in?

    Either way, I'll see what's up. Just curious as it should help me diagnosis this.

  12. Shaun B reporter

    If i close and reopen them, they come back color formatted. Right now any of them that open up first are black and white until i close and reopen.

    I'm using a powershell project

  13. pju

    Yes, the close/open of maintenance.ps1 made the colors kick in. I can't see a pattern in when a file goes in B/W. Have tried a number - and now none of them fails. I am opening solutions.

  14. Adam Driscoll

    Can you please enable debug logging? Tools->Options->PowerShell Tools->Diagnostics

    I was able to reproduce the coloring issue but not the debugging issue. The logs will be written out to %AppData%\PowerShell Tools for Visual Studio

  15. Adam Driscoll

    Just an update. I have been able to reproduce this behavior. The host process isn't actually crashing but the communication channel is Faulting. I find this to happen when I output a lot of info to the screen. Usually, in the event of a host process crash, it will just be restarted but in this case, it's getting stuck in the Faulted state. Will update when I have more info.

  16. Adam Driscoll

    I think I've resolved the issue. Please see version 4.1.3. The problem was that some code had been introduced to return the result of a PowerShell script execution from the host process back to visual studio so it could be used to annotate code for profiling purposes. When an object was returned from the pipeline, it would be serialized to CliXml and sent to VS. The problem is when complex objects go through the serialization process that can cause an infinite loop in the serializer. This results in the host process hanging while attempting to send the result back to VS.

    The code that was introduced for serialization has simply been reverted and now I can successfully run my scripts multiple times. I was testing this using Get-Process which returns Process objects that really don't like to be serialized. You can see a similar behavior if you do something like: Get-Process | ConvertTo-Json.

    Please test 4.1.3 when you have a chance and let me know.

  17. Adam Driscoll

    Sweet. Thanks guys. I'm going to raise a separate issue for you, pju. I was able to reproduce that in my under powered VM but not my desktop.

  18. Log in to comment