dotnet / dotnet/csharp-tmLanguage
[C#] Deeply nested parens causes editor hang.
- Dominant language
- TypeScript
- Stars
- 78
- Forks
- 43
- Avg merge
- 34m
- Merged PRs (30d)
- 1
Description
_From @staticvoidmain on August 2, 2018 16:52_
Issue Type: Bug
# Problem
Too many nested parens on a single line cause C# file to hang.
# Additional Info
- I recently reversed some VB to C# and pasted it into code, resulting in a complete hang of the vscode process.
- It's fine if these are separated into multiple lines as in the example, however if it's all on a *single* line you'll get a hang.
- It's definitely the syntax highlighter, and seems to be specific to C#.
- Tested against insiders, and with no extensions on the current build.
- Tested the same line with other c-like language file extensions (js, ts, cpp, java) and they handle it without a crash.
- Oh, also, if you drop the (object) casts off it's fine as well.
# Steps To Reproduce
1. New file > evil_line.cs
2. Paste these contents
```csharp
// don't try to join these lines...
var message = Conversions.ToString(
Operators.ConcatenateObject(
Operators.ConcatenateObject(
Operators.ConcatenateObject(
Operators.ConcatenateObject(
Operators.ConcatenateObject(
Operators.ConcatenateObject(
Operators.ConcatenateObject(
Operators.ConcatenateObject(
Operators.ConcatenateObject(
Operators.ConcatenateObject(
Operators.ConcatenateObject(
Operators.ConcatenateObject(
Operators.ConcatenateObject(
Operators.ConcatenateObject(
Operators.ConcatenateObject(
Operators.ConcatenateObject(
Operators.ConcatenateObject(
Operators.ConcatenateObject(
Operators.ConcatenateObject(
Operators.ConcatenateObject(
Operators.ConcatenateObject(
(object) strMsg,
Interaction.IIf(
Strings.Len(strMsg) > 0,
(object) "\r\n",
(object) null)),
(object) "\r\n"),
(object) "name '"),
(object) name),
(object) "'"),
(object) "\r\n"),
(object) "age '"),
(object) age),
(object) "'"),
(object) "\r\n"),
(object) "dob '"),
(object) dob),
(object) "'"),
(object) "\r\n"),
(object) "favoriteColor '"),
(object) favoriteColor),
(object) "'"),
(object) "\r\n"),
(object) "favoriteFilm '"),
(object) favoriteFilm),
(object) "'")
);
```
3. Join Lines
VS Code version: Code 1.25.1 (1dfc5e557209371715f655691b1235b6b26a06be, 2018-07-11T15:43:53.668Z)
OS version: Windows_NT x64 10.0.14393
System Info
|Item|Value|
|---|---|
|CPUs|Intel(R) Xeon(R) CPU E5-2695 v2 @ 2.40GHz (4 x 2400)|
|GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: unavailable_software
video_decode: enabled
video_encode: enabled
vpx_decode: enabled
webgl: enabled
webgl2: enabled|
|Memory (System)|12.00GB (7.34GB free)|
|Process Argv|C:\Program Files\Microsoft VS Code\Code.exe|
|Screen Reader|no|
|VM|100%|
Extensions (12)
Extension|Author (truncated)|Version
---|---|---
xml|Dot|2.3.1
EditorConfig|Edi|0.12.4
tslint|eg2|1.0.34
vscode-great-icons|emm|2.1.39
code-beautifier|mic|2.1.0
mssql|ms-|1.4.0
python|ms-|2018.7.1
cpptools|ms-|0.17.7
PowerShell|ms-|1.8.2
team|ms-|1.136.0
debugger-for-chrome|msj|4.8.2
vscode-javascript-booster|sbu|0.10.1
_Copied from original issue: Microsoft/vscode#55687_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.