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

[NBug] Operations that change non-concurrent collections must have exclusive access. #11460

Closed
mstv opened this issue Dec 20, 2023 · 4 comments · Fixed by #11482
Closed

[NBug] Operations that change non-concurrent collections must have exclusive access. #11460

mstv opened this issue Dec 20, 2023 · 4 comments · Fixed by #11482
Assignees
Labels
type: regression regression, normally to latest official release

Comments

@mstv
Copy link
Member

mstv commented Dec 20, 2023

Environment

  • Git Extensions 33.33.33
  • Build c4a15c3
  • Git 2.42.0.windows.1
  • Microsoft Windows NT 10.0.19045.0
  • .NET 8.0.0
  • DPI 96dpi (no scaling)
  • Portable: False

Issue description

System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
   at void GitUI.RevisionGridControl.PerformRefreshRevisions(Func<RefsFilter, IReadOnlyList<IGitRef>> getRefs, bool forceRefreshRefs)+() => { } in D:/Build/gitextensions3/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs:line 1352
   at async Task GitUI.TaskManager.HandleExceptionsAsync(Func<Task> asyncAction, Func<Exception, Task> handleExceptionAsync) in D:/Build/gitextensions3/GitExtUtils/GitUI/TaskManager.cs:line 28

Steps to reproduce

try to open FormFileHistory for FormBrowse.cs

Did this work in previous version of GitExtensions?

yes

Diagnostics

No response

@sharwell
Copy link
Member

sharwell commented Dec 20, 2023

Here's the relevant code:

// Rethrow the exception on the UI thread
ThreadHelper.FileAndForget(() => throw exception);

The true source of the exception is getting lost because the throw exception here is overwriting the original stack trace. It should instead do this:

ThreadHelper.FileAndForget(() => ExceptionDispatchInfo.Throw(exception)); 

@mstv
Copy link
Member Author

mstv commented Dec 20, 2023

Thank you, @sharwell!

@sharwell
Copy link
Member

Note that the change I suggested won't fix the underlying bug. It will simply make it so the next time it occurs, it will have a more usable stack trace for investigation.

mstv added a commit to mstv/gitextensions that referenced this issue Dec 20, 2023
@mstv mstv self-assigned this Dec 20, 2023
@mstv mstv added the type: regression regression, normally to latest official release label Dec 20, 2023
@mstv
Copy link
Member Author

mstv commented Dec 20, 2023

System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
   at bool System.Collections.Generic.Dictionary<TKey, TValue>.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at string GitUI.RevisionGridControl+<>c__DisplayClass145_0.<PerformRefreshRevisions>g__BuildPathFilter|5(?)+BuildPathFilter(string path) in D:/Build/gitextensions3/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs:line 1222
   at void GitUI.RevisionGridControl.PerformRefreshRevisions(Func<RefsFilter, IReadOnlyList<IGitRef>> getRefs, bool forceRefreshRefs)+() => { } in D:/Build/gitextensions3/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs:line 1079
   at void GitUI.TaskManager.HandleExceptions(Action action, Action<Exception> handleException) in D:/Build/gitextensions3/GitExtUtils/GitUI/TaskManager.cs:line 47
   at void GitUI.RevisionGridControl.PerformRefreshRevisions(Func<RefsFilter, IReadOnlyList<IGitRef>> getRefs, bool forceRefreshRefs)+() => { } in D:/Build/gitextensions3/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs:line 1357
   at Func<Task> GitUI.TaskManager.AsyncAction(Action action)+() => { } in D:/Build/gitextensions3/GitExtUtils/GitUI/TaskManager.cs:line 63
   at async Task GitUI.TaskManager.HandleExceptionsAsync(Func<Task> asyncAction, Func<Exception, Task> handleExceptionAsync) in D:/Build/gitextensions3/GitExtUtils/GitUI/TaskManager.cs:line 28

occurs with #11205 only
avoided by 2cb7fff
double refresh resolved by 0272c28

mstv added a commit to mstv/gitextensions that referenced this issue Dec 30, 2023
@ghost ghost added the 🚧 status: in progress Issues which have associated PRs label Dec 30, 2023
mstv added a commit to mstv/gitextensions that referenced this issue Dec 30, 2023
mstv added a commit that referenced this issue Jan 17, 2024
@ghost ghost removed the 🚧 status: in progress Issues which have associated PRs label Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression regression, normally to latest official release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants