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

EnC: Deleting record method that shadows a synthesized one and contains stackalloc may crash the app #69493

Closed
tmat opened this issue Aug 14, 2023 · 0 comments · Fixed by #69545
Assignees
Milestone

Comments

@tmat
Copy link
Member

tmat commented Aug 14, 2023

record C(int X)
{
  bool G(Span<int> s) => true; 
  protected virtual bool PrintMembers(System.Text.StringBuilder builder) => G(stackalloc int[1]);
}

Deleting PrintMembers will crash the runtime if it contains an active statement.

record C(int X)
{
  protected virtual bool PrintMembers(System.Text.StringBuilder builder) => true; // active statement
}

Deleting PrintMembers with an active statement crashes EnC analyzer:

Error (active)	ENC0080	Modifying source file 'D:\Users\tomas\Source\Repos\ConsoleApp38\ConsoleApp38\Program.cs' requires restarting the application due to internal error: System.InvalidOperationException: Unexpected false - line 764
   at Roslyn.Utilities.Contract.Fail(String message, Int32 lineNumber)
   at Microsoft.CodeAnalysis.EditAndContinue.AbstractEditAndContinueAnalyzer.AnalyzeUnchangedActiveMemberBodies(ArrayBuilder`1 diagnostics, Match`1 topMatch, SourceText newText, ImmutableArray`1 oldActiveStatements, ImmutableArray`1 newActiveStatementSpans, Builder newActiveStatements, Builder newExceptionRegions, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.EditAndContinue.AbstractEditAndContinueAnalyzer.AnalyzeDocumentAsync(Project oldProject, AsyncLazy`1 lazyOldActiveStatementMap, Document newDocument, ImmutableArray`1 newActiveStatementSpans, AsyncLazy`1 lazyCapabilities, CancellationToken cancellationToken)	ConsoleApp38, ConsoleApp38	D:\Users\tomas\Source\Repos\ConsoleApp38\ConsoleApp38\Program.cs	1	
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Interactive untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 14, 2023
@tmat tmat added Interactive-EnC and removed Area-Interactive untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 14, 2023
@tmat tmat self-assigned this Aug 14, 2023
@tmat tmat added this to the 17.8 milestone Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant