Problem:GroupBy(...).ToDictionary(..., g => g.Last()) silently picks the last registrar for duplicate LanguageId values. Misconfiguration (duplicate registrations) goes unnoticed.
Fix: Throw a descriptive exception when a duplicate is detected:
The factory now scans for duplicate LanguageId registrations and throws InvalidOperationException with the offending key(s) and counts during construction:
**Resolved.**
The factory now scans for duplicate `LanguageId` registrations and throws `InvalidOperationException` with the offending key(s) and counts during construction:
```csharp
var duplicates = grouped.Where(g => g.Count() > 1).Select(g => $"{g.Key} ({g.Count()})").ToList();
if (duplicates.Count > 0)
throw new InvalidOperationException("Duplicate IFreePlayCodeExecutor registrations detected: ...");
```
Single-registration behaviour is unchanged. Misconfiguration now fails loudly at startup instead of silently selecting the last registrant.
File: `SpikerSoft.Business/Domain/CodeExecution/Execution/FreePlayCodeExecutorFactory.cs`.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Severity: Medium (DI safety)
File:
SpikerSoft.Business/Domain/CodeExecution/Execution/FreePlayCodeExecutorFactory.cs(~16-18)Problem:
GroupBy(...).ToDictionary(..., g => g.Last())silently picks the last registrar for duplicateLanguageIdvalues. Misconfiguration (duplicate registrations) goes unnoticed.Fix: Throw a descriptive exception when a duplicate is detected:
Acceptance criteria:
Resolved.
The factory now scans for duplicate
LanguageIdregistrations and throwsInvalidOperationExceptionwith the offending key(s) and counts during construction:Single-registration behaviour is unchanged. Misconfiguration now fails loudly at startup instead of silently selecting the last registrant.
File:
SpikerSoft.Business/Domain/CodeExecution/Execution/FreePlayCodeExecutorFactory.cs.