sillsdev / sillsdev/l10nsharp

ExtractionExceptions is a non-thread-safe List<string> accessed from concurrent threads

Open Beginner friendly
#152 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api change bug
Dominant language
C#
Stars
3
Forks
10
Avg merge
4d 12h
Merged PRs (30d)
9

Description

ExtractionExceptions is declared as static List<string>. When ExtractStringsFromCode is called from concurrent threads, multiple threads may call AddRange on the same list simultaneously, causing data corruption.

Fix: Change ExtractionExceptions from List<string> to ConcurrentBag<string> and replace AddRange calls with individual Add calls.

Files affected: src/L10NSharp/XLiffUtils/XliffLocalizationManager.cs

(Part of #135.)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open src/L10NSharp/XLiffUtils/XliffLocalizationManager.cs and inspect ExtractionExceptions and the AddRange calls used by ExtractStringsFromCode. Change the collection and additions as specified, then verify that concurrent calls no longer share a non-thread-safe list or corrupt exception data.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.