From 91db58bfffabe9b5da14ad329058113b6f752752 Mon Sep 17 00:00:00 2001 From: bchavez Date: Wed, 7 Dec 2016 11:32:47 -0800 Subject: [PATCH] Fixes #46. Thread deadlock can appear with large/many static field Faker initializations. --- HISTORY.md | 1 + Source/Bogus/Randomizer.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index b7c7fe66..125a8fc7 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,4 +1,5 @@ ## v8.0.2 +* Issue 46. Fixed threading deadlock situation with static faker initialization. Thanks Mpdreamz. * Added `f => f.Generate(count, ()=> f.Phone.PhoneNumber())` helper for better fluency when filling properties with `List` of `T`. ## v8.0.1 diff --git a/Source/Bogus/Randomizer.cs b/Source/Bogus/Randomizer.cs index 545535e3..e010a7a2 100644 --- a/Source/Bogus/Randomizer.cs +++ b/Source/Bogus/Randomizer.cs @@ -19,7 +19,7 @@ public class Randomizer /// public static Random Seed = new Random(); - internal static Lazy Locker = new Lazy(() => new object(), LazyThreadSafetyMode.PublicationOnly); + internal static Lazy Locker = new Lazy(() => new object(), LazyThreadSafetyMode.ExecutionAndPublication); /// /// Get an int from 0 to max.