Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

DI registrations create separate backing stores when tracing is disabled

Aperta
#610 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 7 giorni

@nmummau ci sta già lavorando.

Dal 14/10/2026.

  • #622 di @nmummau — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
15/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
csharp
Ambito
backend

Direzione di ricerca

The issue names StoreRegistrationTests.cs under src/Extensions/test/Eventuous.Tests.DependencyInjection and describes the affected AddEventStore, AddEventReaderWriter, AddEventReader, and AddEventWriter APIs. Start by reviewing the existing regression tests and tracing how registrations resolve shared stores with diagnostics enabled and disabled. Done means the listed host, factory, scope, and diagnostics cases pass; the issue says an implementation is already committed locally, so check whether that work is still available before starting.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Related test issue

Discovered while implementing #608 — event-store dependency injection coverage.

Problem

With EventuousDiagnostics disabled, store registration methods register implementations or factories separately for each interface. Each interface therefore gets its own singleton rather than sharing one backing instance.

A successful append through IEventWriter can be followed by StreamNotFound when the same stream is read through IEventReader. This is reproducible with the stateful InMemoryEventStore; it is not a claim that persistent providers lose stored data. Factories can also run more than once, and standalone reader/writer registrations can ignore an already registered concrete store.

Affected APIs include the generic and factory overloads of AddEventStore<T>, AddEventReaderWriter<T>, and separately composed AddEventReader<T> / AddEventWriter<T>.

Reproduction

  1. Disable diagnostics, preserving the previous setting for restoration afterward.
  2. Build a host with services.AddEventStore<InMemoryEventStore>().
  3. Resolve IEventWriter and IEventReader from that host.
  4. Append an event to a new stream through the writer.
  5. Read that stream through the reader.

Actual: the read throws StreamNotFound because the interfaces resolve to different stores.

Expected: all interfaces registered for the same implementation share one backing singleton. Changing tracing configuration must not change which events are visible.

Fix and acceptance criteria

  • Register the concrete implementation or factory once, then resolve interface aliases from that singleton.
  • Verify append/read behavior through a real host for store, combined reader/writer, and separately registered reader/writer APIs.
  • Cover generic and factory overloads with tracing enabled and disabled.
  • Factories are invoked once for the shared instance, and interface resolutions remain singleton across scopes.
  • Standalone reader/writer registrations reuse a pre-registered concrete instance without invoking a replacement factory.
  • Tests restore the process-wide diagnostics setting and cannot race with other tests that observe it.

Existing regression tests and implementation

StoreRegistrationTests.cs in src/Extensions/test/Eventuous.Tests.DependencyInjection contains:

  • WrittenEventsAreVisibleThroughEveryRegisteredInterface
  • StandaloneRegistrationUsesTheExistingBackingStore
  • The tracing-disabled cases of RepeatedRegistrationKeepsOneServiceAndOneFactory

These scenarios failed before the production fix. The complete DI project passes all 31 tests on .NET 10 after the fixes for this issue and the companion registration issue.

An implementation is already committed locally on fix/issue-608-store-registrations, commit df3dbe48. It also fixes duplicate registrations and overridden services; this draft does not imply the fix has been published or merged.

Lingua principale
C#
Stelle
512
Fork
99
Merge medio
5g 6h
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Eventuous/eventuous

Tutte le issue di Eventuous/eventuous

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.