Skip to content

Commit e8f3c29

Browse files
committed
avoid WPF contention-inline problems with transaction
1 parent 45f6342 commit e8f3c29

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

FSharp.Data.Adaptive.sln

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Scratch", "src\Demo\Scratch
2626
EndProject
2727
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "PublishTrimmedTest", "src\Demo\PublishTrimmedTest\PublishTrimmedTest.fsproj", "{11280471-7178-4DC3-9BAD-18411B1AE62B}"
2828
EndProject
29+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9C4FEF40-2460-4739-ADC2-AF2FC7F658CE}"
30+
ProjectSection(SolutionItems) = preProject
31+
paket.dependencies = paket.dependencies
32+
paket.lock = paket.lock
33+
README.md = README.md
34+
RELEASE_NOTES.md = RELEASE_NOTES.md
35+
EndProjectSection
36+
EndProject
2937
Global
3038
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3139
Debug|Any CPU = Debug|Any CPU

RELEASE_NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### 1.2.16
2+
* avoid WPF contention-inline problems with transaction
3+
14
### 1.2.15
25
* updated MultiCallbackObject with proper locking https://github.com/fsprojects/FSharp.Data.Adaptive/pull/113
36

src/FSharp.Data.Adaptive/Core/Transaction.fs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,12 @@ type Transaction() =
181181
e.AllInputsProcessed(x)
182182

183183
else
184+
// WPF Synchronization-Context inlines code in contending locks.
185+
// https://stackoverflow.com/questions/8431221/why-did-entering-a-lock-on-a-ui-thread-trigger-an-onpaint-event
186+
// Therefore we treat the "inlined" code as if it were running on a different thread (without a current transaction)
187+
Transaction.RunningTransaction <- ValueNone
184188
e.EnterWrite()
189+
Transaction.RunningTransaction <- ValueSome x
185190
try
186191
outputCount <- 0
187192

0 commit comments

Comments
 (0)