DynamicData
DynamicData copied to clipboard
[Bug]: SourceCache with Sample and TransformWithInlineUpdate throws DynamicData.MissingKeyException
Describe the bug 🐞
SourceCache
with Sample
and TransformWithInlineUpdate
throws DynamicData.MissingKeyException
with message "1 is not found." Sample
with Transform
works well, but I need inline update to ensure correct selection behavior in DataGrid
control.
SourceCache<..., ...> cache = new(...);
cache.Connect()
.Sample(TimeSpan.FromMilliseconds(1000))
//.Transform(x => ...) //works well
.TransformWithInlineUpdate( //throws on running
transformFactory: x => ...,
updateAction: (y, x) => ...,
)
.Subscribe();
Observable.Timer(TimeSpan.Zero, TimeSpan.FromMilliseconds(100))
.Subscribe(x =>
cache.AddOrUpdate(...);
);
And I find that if difference of elapse of Timer
and Sample
is small like this:
cache.Connect()
.Sample(TimeSpan.FromMilliseconds(1000))
...
Observable.Timer(TimeSpan.Zero, TimeSpan.FromMilliseconds(980))
it won't throw the exception, sometimes, maybe first run works well but stop and re-run throws. If elapse of Timer
is greater than Sample
it won't throw.
I have uploaded the minimum console project.
Step to reproduce
- Clone the reproduction repository
- Build and run
- See error
Reproduction repository
https://github.com/ethpch/DynamicData.Test
Expected behavior
Sample
with TransformWithInlineUpdate
works as expected.
Screenshots 🖼️
IDE
Visual Studio 2022
Operating system
Windows
Version
23H2, 22631.4317
Device
Desktop
DynamicData Version
9.0.4
Additional information ℹ️
No response