dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.88k stars 677 forks source link

Vs code hangs formatting c# #2878

Closed luca1010 closed 3 weeks ago

luca1010 commented 5 years ago

Issue Description

Open a new Vs code document (plain text), paste the code below. Then set the language mode (click on status bar) to C#. Vs code is no more responsive, all the windows and documents are blocked. Forcing it to close and reopening I return to the situation just before the change of language mode. I tried it different times, same result. Removing all the ? from code does not change the outcome. I tried several other c# snippets and they work as expected. This one contains something that crashes the extension.

Steps to Reproduce

paste this in a new vs code tab, then set language mode to c#

public virtual int insertGeoPosition(int? iMessageId, int? iSats, string vchUnit, int? iHeading, int? iAccuracy, string vchDirectionOfDrive, double? flLatitude, double? flLongitude, int? iAltitude, string vchCity, string vchStreetAddress, string chStreetNumber, string chZipCode, string chProvince, string vchCountry, string chNationCode, int? iSpeed, string vchQualityIndicator, int? iEstimatedAccuracy, string chRoadType, string chPositionType, string vchAdditionalInformation, DateTime? dtTimestamp, string chInsertBy)
    {
      return this.ObjectContext.ExecuteFunction(nameof (insertGeoPosition), iMessageId.HasValue ? new ObjectParameter(nameof (iMessageId), (object) iMessageId) : new ObjectParameter(nameof (iMessageId), typeof (int)), iSats.HasValue ? new ObjectParameter(nameof (iSats), (object) iSats) : new ObjectParameter(nameof (iSats), typeof (int)), vchUnit != null ? new ObjectParameter(nameof (vchUnit), (object) vchUnit) : new ObjectParameter(nameof (vchUnit), typeof (string)), iHeading.HasValue ? new ObjectParameter(nameof (iHeading), (object) iHeading) : new ObjectParameter(nameof (iHeading), typeof (int)), iAccuracy.HasValue ? new ObjectParameter(nameof (iAccuracy), (object) iAccuracy) : new ObjectParameter(nameof (iAccuracy), typeof (int)), vchDirectionOfDrive != null ? new ObjectParameter(nameof (vchDirectionOfDrive), (object) vchDirectionOfDrive) : new ObjectParameter(nameof (vchDirectionOfDrive), typeof (string)), flLatitude.HasValue ? new ObjectParameter(nameof (flLatitude), (object) flLatitude) : new ObjectParameter(nameof (flLatitude), typeof (double)), flLongitude.HasValue ? new ObjectParameter(nameof (flLongitude), (object) flLongitude) : new ObjectParameter(nameof (flLongitude), typeof (double)), iAltitude.HasValue ? new ObjectParameter(nameof (iAltitude), (object) iAltitude) : new ObjectParameter(nameof (iAltitude), typeof (int)), vchCity != null ? new ObjectParameter(nameof (vchCity), (object) vchCity) : new ObjectParameter(nameof (vchCity), typeof (string)), vchStreetAddress != null ? new ObjectParameter(nameof (vchStreetAddress), (object) vchStreetAddress) : new ObjectParameter(nameof (vchStreetAddress), typeof (string)), chStreetNumber != null ? new ObjectParameter(nameof (chStreetNumber), (object) chStreetNumber) : new ObjectParameter(nameof (chStreetNumber), typeof (string)), chZipCode != null ? new ObjectParameter(nameof (chZipCode), (object) chZipCode) : new ObjectParameter(nameof (chZipCode), typeof (string)), chProvince != null ? new ObjectParameter(nameof (chProvince), (object) chProvince) : new ObjectParameter(nameof (chProvince), typeof (string)), vchCountry != null ? new ObjectParameter(nameof (vchCountry), (object) vchCountry) : new ObjectParameter(nameof (vchCountry), typeof (string)), chNationCode != null ? new ObjectParameter(nameof (chNationCode), (object) chNationCode) : new ObjectParameter(nameof (chNationCode), typeof (string)), iSpeed.HasValue ? new ObjectParameter(nameof (iSpeed), (object) iSpeed) : new ObjectParameter(nameof (iSpeed), typeof (int)), vchQualityIndicator != null ? new ObjectParameter(nameof (vchQualityIndicator), (object) vchQualityIndicator) : new ObjectParameter(nameof (vchQualityIndicator), typeof (string)), iEstimatedAccuracy.HasValue ? new ObjectParameter(nameof (iEstimatedAccuracy), (object) iEstimatedAccuracy) : new ObjectParameter(nameof (iEstimatedAccuracy), typeof (int)), chRoadType != null ? new ObjectParameter(nameof (chRoadType), (object) chRoadType) : new ObjectParameter(nameof (chRoadType), typeof (string)), chPositionType != null ? new ObjectParameter(nameof (chPositionType), (object) chPositionType) : new ObjectParameter(nameof (chPositionType), typeof (string)), vchAdditionalInformation != null ? new ObjectParameter(nameof (vchAdditionalInformation), (object) vchAdditionalInformation) : new ObjectParameter(nameof (vchAdditionalInformation), typeof (string)), dtTimestamp.HasValue ? new ObjectParameter(nameof (dtTimestamp), (object) dtTimestamp) : new ObjectParameter(nameof (dtTimestamp), typeof (DateTime)), chInsertBy != null ? new ObjectParameter(nameof (chInsertBy), (object) chInsertBy) : new ObjectParameter(nameof (chInsertBy), typeof (string)));
    }

Expected Behavior

code should be formatted

Actual Behavior

Vs code hangs

Logs

OmniSharp log

Post the output from Output-->OmniSharp log here

Vs hangs and nothing is shown on log.

C# log

Post the output from Output-->C# here

Vs hangs and nothing is shown on log.

Environment information

VSCode version: 1.31.1 C# Extension: 1.17.1

Dotnet Information .NET Core SDK (che rispecchia un qualsiasi file global.json): Version: 2.2.102 Commit: 96ff75a873 Ambiente di runtime: OS Name: Windows OS Version: 10.0.17763 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.2.102\ Host (useful for support): Version: 2.2.1 Commit: 878dd11e62 .NET Core SDKs installed: 1.0.0-preview2-003131 [C:\Program Files\dotnet\sdk] 1.1.7 [C:\Program Files\dotnet\sdk] 1.1.9 [C:\Program Files\dotnet\sdk] 1.1.11 [C:\Program Files\dotnet\sdk] 2.1.4 [C:\Program Files\dotnet\sdk] 2.1.200 [C:\Program Files\dotnet\sdk] 2.1.202 [C:\Program Files\dotnet\sdk] 2.1.403 [C:\Program Files\dotnet\sdk] 2.1.503 [C:\Program Files\dotnet\sdk] 2.2.102 [C:\Program Files\dotnet\sdk] .NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 1.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions |Extension|Author|Version| |---|---|---| |aspnet-helper|schneiderpat|0.6.4| |azure-account|ms-vscode|0.8.0| |code-runner|formulahendry|0.9.7| |csharp|ms-vscode|1.17.1| |debugger-for-chrome|msjsdiag|4.11.2| |html-css-class-completion|Zignd|1.18.0| |JavaScriptSnippets|xabikos|1.7.2| |jquerysnippets|donjayamanne|0.0.1| |json-tools|eriklynd|1.0.2| |json2ts|GregorBiswanger|0.0.6| |Material-theme|zhuangtongfa|2.18.2| |mongogo|bagonaut|0.1.2| |move-ts|stringham|1.11.3| |mssql|ms-mssql|1.4.0| |path-intellisense|christian-kohler|1.4.2| |PowerShell|ms-vscode|1.11.0| |prettier-vscode|esbenp|1.8.1| |prettify-json|mohsen1|0.0.3| |quicktype|quicktype|12.0.46| |quokka-vscode|WallabyJs|1.0.189| |rest-client|humao|0.21.1| |team|ms-vsts|1.144.1| |ts-extension-pack|loiane|0.2.0| |tsimporter|pmneo|1.2.14| |tslint|eg2|1.0.43| |typescript-hero|rbbit|3.0.0| |vscode-cosmosdb|ms-azuretools|0.10.0| |vscode-generate-getter-setter|DSKWRK|0.5.0| |vscode-html-css|ecmel|0.2.0| |vscode-json-transform|octref|0.1.2| |vscode-kanban|mkloubert|1.24.0| |vscode-kubernetes-tools|ms-kubernetes-tools|0.1.16| |vscode-sort-json|richie5um2|1.13.0| |vscode-typescript-tslint-plugin|ms-vscode|1.0.0| |vscode-yaml|redhat|0.3.0| |xml|DotJoshJohnson|2.4.0| |xml2json|buianhthang|1.2.1|;
JoeRobich commented 3 weeks ago

Cannot reproduce with the current release.