Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VisualBasicOrganizeImportsService.OrganizeImportsAsync throws InsufficientExecutionStackException #44710

Closed
JoeRobich opened this issue May 30, 2020 · 1 comment

Comments

@JoeRobich
Copy link
Member

Running Formatter.OrganizeImports against T_68086.vb causes InsufficientExecutionStackException.

Stacktrace:
Unhandled exception: System.InsufficientExecutionStackException: Insufficient stack to continue executing the program safely. This can happen from having too many functions on the call stack or function on the stack using too much stack space.
   at System.Runtime.CompilerServices.RuntimeHelpers.EnsureSufficientExecutionStack()
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.Visit(SyntaxNode node) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 36
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitBinaryExpression(BinaryExpressionSyntax node) in /_/src/Compilers/VisualBasic/Portable/Generated/Syntax.xml.Main.Generated.vb:line 4139
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.Visit(SyntaxNode node) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 31
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitBinaryExpression(BinaryExpressionSyntax node) in /_/src/Compilers/VisualBasic/Portable/Generated/Syntax.xml.Main.Generated.vb:line 4139
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.Visit(SyntaxNode node) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 31
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitBinaryExpression(BinaryExpressionSyntax node) in /_/src/Compilers/VisualBasic/Portable/Generated/Syntax.xml.Main.Generated.vb:line 4139
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.Visit(SyntaxNode node) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 31

... So many more of the last two lines ...

   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitBinaryExpression(BinaryExpressionSyntax node) in /_/src/Compilers/VisualBasic/Portable/Generated/Syntax.xml.Main.Generated.vb:line 4139
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.Visit(SyntaxNode node) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 31
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitEqualsValue(EqualsValueSyntax node) in /_/src/Compilers/VisualBasic/Portable/Generated/Syntax.xml.Main.Generated.vb:line 2569
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.Visit(SyntaxNode node) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 31
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitVariableDeclarator(VariableDeclaratorSyntax node) in /_/src/Compilers/VisualBasic/Portable/Generated/Syntax.xml.Main.Generated.vb:line 2452
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.Visit(SyntaxNode node) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 31
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitListElement[TNode](TNode node) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 101
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitList[TNode](SeparatedSyntaxList`1 list) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 167
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node) in /_/src/Compilers/VisualBasic/Portable/Generated/Syntax.xml.Main.Generated.vb:line 2801
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.Visit(SyntaxNode node) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 31
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitListElement[TNode](TNode node) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 101
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitList[TNode](SyntaxList`1 list) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 81
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitTryBlock(TryBlockSyntax node) in /_/src/Compilers/VisualBasic/Portable/Generated/Syntax.xml.Main.Generated.vb:line 3049
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.Visit(SyntaxNode node) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 31
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitListElement[TNode](TNode node) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 101
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitList[TNode](SyntaxList`1 list) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 81
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitMethodBlock(MethodBlockSyntax node) in /_/src/Compilers/VisualBasic/Portable/Generated/Syntax.xml.Main.Generated.vb:line 1999
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.Visit(SyntaxNode node) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 31
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitListElement[TNode](TNode node) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 101
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitList[TNode](SyntaxList`1 list) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 81
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitModuleBlock(ModuleBlockSyntax node) in /_/src/Compilers/VisualBasic/Portable/Generated/Syntax.xml.Main.Generated.vb:line 1654
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.Visit(SyntaxNode node) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 31
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitListElement[TNode](TNode node) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 101
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitList[TNode](SyntaxList`1 list) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 81
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitNamespaceBlock(NamespaceBlockSyntax node) in /_/src/Compilers/VisualBasic/Portable/Generated/Syntax.xml.Main.Generated.vb:line 1618
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.Visit(SyntaxNode node) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 31
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitListElement[TNode](TNode node) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 101
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitList[TNode](SyntaxList`1 list) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 81
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitCompilationUnit(CompilationUnitSyntax node) in /_/src/Compilers/VisualBasic/Portable/Generated/Syntax.xml.Main.Generated.vb:line 1522
   at Microsoft.CodeAnalysis.VisualBasic.OrganizeImports.VisualBasicOrganizeImportsService.Rewriter.VisitCompilationUnit(CompilationUnitSyntax node) in /_/src/Workspaces/VisualBasic/Portable/OrganizeImports/VisualBasicOrganizeImportsService.Rewriter.vb:line 25
   at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.Visit(SyntaxNode node) in /_/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxRewriter.vb:line 31
   at Microsoft.CodeAnalysis.VisualBasic.OrganizeImports.VisualBasicOrganizeImportsService.OrganizeImportsAsync(Document document, CancellationToken cancellationToken) in /_/src/Workspaces/VisualBasic/Portable/OrganizeImports/VisualBasicOrganizeImportsService.vb:line 29
   at Microsoft.CodeAnalysis.Tools.Formatters.ImportsFormatter.FormatFileAsync(Document document, SourceText sourceText, OptionSet optionSet, AnalyzerConfigOptions analyzerConfigOptions, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken) in /Volumes/Data/Source/format/src/Formatters/ImportsFormatter.cs:line 30
   at Microsoft.CodeAnalysis.Tools.Formatters.DocumentFormatter.GetFormattedSourceTextAsync(Document document, OptionSet optionSet, AnalyzerConfigOptions analyzerConfigOptions, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken) in /Volumes/Data/Source/format/src/Formatters/DocumentFormatter.cs:line 100
   at Microsoft.CodeAnalysis.Tools.Formatters.DocumentFormatter.<>c__DisplayClass4_1.<<FormatFiles>b__0>d.MoveNext() in /Volumes/Data/Source/format/src/Formatters/DocumentFormatter.cs:line 79
--- End of stack trace from previous location where exception was thrown ---

... dotnet-format stack
@CyrusNajmabadi
Copy link
Member

FWIW, our position is generally that we do not support unbounded stacks for generated code. That code def doesn't look handwritten to me.

@jinujoseph jinujoseph added the Bug label Jun 10, 2020
@jinujoseph jinujoseph added this to the Backlog milestone Jun 10, 2020
@CyrusNajmabadi CyrusNajmabadi closed this as not planned Won't fix, can't repro, duplicate, stale Oct 21, 2024
@dotnet dotnet locked and limited conversation to collaborators Oct 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants