waf / CSharpRepl

A command line C# REPL with syntax highlighting – explore the language, libraries and nuget packages interactively.
https://fuqua.io/CSharpRepl/
Mozilla Public License 2.0
2.95k stars 112 forks source link

Fix multithreading issue in ConsoleNugetLogger #322

Closed waf closed 1 year ago

waf commented 1 year ago

Add some locking to prevent multithreading-related errors in ConsoleNugetLogger.

There could be some more interesting ways of solving this (e.g. immutable collections, or concurrent collections with snapshotting), but let's just try some good ol' fashioned locking first.

Fixes #311. Note that the nuget package mentioned in that issue doesn't actually appear to be installable in .NET 8 (I believe it's an issue with the package, as opposed to an issue with CSharpRepl). But this PR fixes the exception mentioned in that issue.

codecov[bot] commented 1 year ago

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (ba21d40) 77.4% compared to head (f0478df) 77.4%.

Files Patch % Lines
CSharpRepl.Services/Nuget/ConsoleNugetLogger.cs 94.1% 0 Missing and 2 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #322 +/- ## ===================================== Coverage 77.4% 77.4% ===================================== Files 83 83 Lines 5583 5596 +13 Branches 736 735 -1 ===================================== + Hits 4323 4336 +13 Misses 992 992 Partials 268 268 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.