csharp-tmLanguage icon indicating copy to clipboard operation
csharp-tmLanguage copied to clipboard

Code hangs when trying to open C# File

Open aeschli opened this issue 8 years ago • 4 comments

From @leadZERO on July 17, 2017 21:8

I have a CSharp file that will cause Code to become unresponsive every time it is opened. I've tried to narrow it down to what about the file causes it, but it doesn't seem to be a single line, nor consistent. I've uninstalled all the extensions, tried running with --disable-extensions, and closing the active folder. I've also run code with --verbose, but it doesn't report anything after the arg display other than:

[main 3:02:30 PM] IPC#vscode-machineId [main 3:02:30 PM] IPC#vscode-workbenchLoaded [VS Code]: detected unresponsive

I'd be happy to email the file to one of the devs, but don't want to post on the open Internet.

R

  • VSCode Version: 1.14.1
  • OS Version: OS X 10.12.5

Steps to Reproduce:

  1. Launch Code
  2. Try to open file.

Reproduces without extensions: Yes

Copied from original issue: Microsoft/vscode#30884

aeschli avatar Jul 20 '17 01:07 aeschli

Hi @leadZERO, Feel free to email the file to me and I'll take a look. Thanks! dustinca AT microsoft.com.

DustinCampbell avatar Jul 20 '17 12:07 DustinCampbell

Thanks for sending me the file @leadZERO. I isolated the code causing the hang to a very deeply nested expression:

public class C {
	public M() {
		var x = (((A & ~0x3f) == 0 && ((1L << B) & ((1L << C) | (1L << D) | (1L << E) | (1L << F) | (1L << G) | (1L << H) | (1L << I) | (1L << J) | (1L << K) | (1L << L) | (1L << M) | (1L << N) | (1L << O) | (1L << P) | (1L << Q) | (1L << R) | (1L << S) | (1L << T) | (1L << U) | (1L << V) | (1L << W) | (1L << X))) != 0));
	}
}

However, if I break that 324 character line onto separate lines, it no longer hangs:

public class C {
	public M() {
		var x = (((A & ~0x3f) == 0 && ((1L << B) & ((1L << C) | (1L << D) | (1L << E) | (1L << F) | (1L << G) | (1L << H) | (1L << I)
			  | (1L << J) | (1L << K) | (1L << L) | (1L << M) | (1L << N) | (1L << O) | (1L << P) | (1L << Q) | (1L << R) | (1L << S)
			  | (1L << T) | (1L << U) | (1L << V) | (1L << W) | (1L << X))) != 0));
	}
}

DustinCampbell avatar Jul 20 '17 20:07 DustinCampbell

Thanks! I had attempted to remove this line to see if it helped, but it didn't seem to do anything. I must have missed something somewhere.

R

On Thu, Jul 20, 2017 at 2:19 PM Dustin Campbell [email protected] wrote:

Thanks for sending me the file @leadZERO https://github.com/leadzero. I isolated the code causing the hang to a very deeply nested expression:

public class C { public M() { var x = (((A & ~0x3f) == 0 && ((1L << B) & ((1L << C) | (1L << D) | (1L << E) | (1L << F) | (1L << G) | (1L << H) | (1L << I) | (1L << J) | (1L << K) | (1L << L) | (1L << M) | (1L << N) | (1L << O) | (1L << P) | (1L << Q) | (1L << R) | (1L << S) | (1L << T) | (1L << U) | (1L << V) | (1L << W) | (1L << X))) != 0)); } }

However, if I break that 324 character line onto separate lines, it no longer hangs:

public class C { public M() { var x = (((A & ~0x3f) == 0 && ((1L << B) & ((1L << C) | (1L << D) | (1L << E) | (1L << F) | (1L << G) | (1L << H) | (1L << I) | (1L << J) | (1L << K) | (1L << L) | (1L << M) | (1L << N) | (1L << O) | (1L << P) | (1L << Q) | (1L << R) | (1L << S) | (1L << T) | (1L << U) | (1L << V) | (1L << W) | (1L << X))) != 0)); } }

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dotnet/csharp-tmLanguage/issues/79#issuecomment-316818265, or mute the thread https://github.com/notifications/unsubscribe-auth/ABNyABw4TBfuNQMkR_qaJpS4RA57Tpurks5sP7ZHgaJpZM4Odf8- .

--

Ryan Sommers

[email protected]

leadZERO avatar Jul 20 '17 20:07 leadZERO

There are a couple of other super-long expressions in while clauses later in the file. Breaking those onto separate lines should help.

DustinCampbell avatar Jul 20 '17 21:07 DustinCampbell