Skip to content

Avoid 'Collection was modified' InvalidOperationException - #6935

Merged
mavasani merged 1 commit into
dotnet:mainfrom
mavasani:Issue6929
Sep 14, 2023
Merged

Avoid 'Collection was modified' InvalidOperationException#6935
mavasani merged 1 commit into
dotnet:mainfrom
mavasani:Issue6929

Conversation

@mavasani

Copy link
Copy Markdown

Fixes #6929

Ensure that we do not perform any state updates to the dataflow CoreAnalysisData inside the loop for the method ClearOverlappingAnalysisDataForIndexedEntity. We instead collect the key-value pairs to be updated in the loop, and perform these updates after the loop.

I haven't been able to come up with a minimal repro case that reproduces this exception, but the loop for which exception was generated can no longer perform any state updates, so we can be quite certain the underlying exception can no longer be thrown.

Fixes dotnet#6929

Ensure that we do not perform any state updates to the dataflow CoreAnalysisData inside the loop for the method `ClearOverlappingAnalysisDataForIndexedEntity`. We instead collect the key-value pairs to be updated in the loop, and perform these updates after the loop.

I haven't been able to come up with a minimal repro case that reproduces this exception, but the loop for which exception was generated can no longer perform any state updates, so we can be quite certain the underlying exception can no longer be thrown.
@mavasani
mavasani requested a review from a team as a code owner September 14, 2023 04:05

@carlossanlop carlossanlop left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

FYI we recently enabled the backporting bot for this repo: #6892 so that an 8.0 PR gets autocreated for you. You only need to write this comment in this PR:

/backport to release/8.0.1xx

@mavasani
mavasani enabled auto-merge September 14, 2023 04:15
@mavasani
mavasani merged commit 0c5fe38 into dotnet:main Sep 14, 2023
@mavasani

Copy link
Copy Markdown
Author

/backport to release/8.0.1xx

@github-actions

Copy link
Copy Markdown

Started backporting to release/8.0.1xx: https://github.com/dotnet/roslyn-analyzers/actions/runs/6180952187

@github-actions

Copy link
Copy Markdown

@mavasani an error occurred while backporting to release/8.0.1xx, please check the run log for details!

Error: @mavasani is not a repo collaborator, backporting is not allowed. If you're a collaborator please make sure your dotnet team membership visibility is set to Public on https://github.com/orgs/dotnet/people?query=mavasani

@mavasani

Copy link
Copy Markdown
Author

/backport to release/8.0.1xx

@github-actions

Copy link
Copy Markdown

Started backporting to release/8.0.1xx: https://github.com/dotnet/roslyn-analyzers/actions/runs/6180962334

@mavasani

Copy link
Copy Markdown
Author

@mavasani an error occurred while backporting to release/8.0.1xx, please check the run log for details!

Error: @mavasani is not a repo collaborator, backporting is not allowed. If you're a collaborator please make sure your dotnet team membership visibility is set to Public on https://github.com/orgs/dotnet/people?query=mavasani

FYI @Youssef1313 This is probably the reason why my PRs were getting marked with community label. I have made this fix now. We can probably close out #6372

@mavasani
mavasani deleted the Issue6929 branch September 15, 2023 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants