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

ArgumentOutOfRangeException in StringBuilder.ToString #8

Closed
bgrainger opened this issue Mar 15, 2021 · 0 comments
Closed

ArgumentOutOfRangeException in StringBuilder.ToString #8

bgrainger opened this issue Mar 15, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@bgrainger
Copy link
Member

Unhandled exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'chunkLength')
   at System.Text.StringBuilder.ToString()
   at CloneLeeroy.Program.RunGit(String workingDirectory, String[] arguments) in /_/src/CloneLeeroy/Program.cs:line 229
   at CloneLeeroy.Program.UpdateSubmodule(String folder, String name, String branch) in /_/src/CloneLeeroy/Program.cs:line 168
   at CloneLeeroy.Program.Run(Boolean save, Boolean solutionInfoCsharp, Boolean solutionInfoHeader, String project) in /_/src/CloneLeeroy/Program.cs:line 112
   at CloneLeeroy.Program.<>c.<<Main>b__0_1>d.MoveNext() in /_/src/CloneLeeroy/Program.cs:line 53

Could presumably happen due to multithreaded access of the StringBuilder: https://stackoverflow.com/questions/38564486/system-argumentoutofrangeexception-parameter-name-chunklength-at-system-text-st

Although await process.WaitForExitAsync(); happens before the StringBuilder is accessed, it's plausible that the event handler is still running in the background.

We should solve this with a lock.

@bgrainger bgrainger added the bug Something isn't working label Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant