Index: System.Data.SQLite/UnsafeNativeMethods.cs ================================================================== --- System.Data.SQLite/UnsafeNativeMethods.cs +++ System.Data.SQLite/UnsafeNativeMethods.cs @@ -12,15 +12,13 @@ #if !NET_COMPACT_20 && (TRACE_DETECTION || TRACE_SHARED || TRACE_PRELOAD || TRACE_HANDLE) using System.Diagnostics; #endif -#if PRELOAD_NATIVE_LIBRARY using System.Collections.Generic; using System.IO; using System.Reflection; -#endif #if !PLATFORM_COMPACTFRAMEWORK && !DEBUG using System.Security; #endif @@ -272,21 +270,24 @@ ///////////////////////////////////////////////////////////////////// #region Debug Build Only #if DEBUG - // - // NOTE: Update statistics for this setting value. - // - if (settingReadCounts != null) - { - int count; - - if (settingReadCounts.TryGetValue(name, out count)) - settingReadCounts[name] = count + 1; - else - settingReadCounts.Add(name, 1); + lock (staticSyncRoot) + { + // + // NOTE: Update statistics for this setting value. + // + if (settingReadCounts != null) + { + int count; + + if (settingReadCounts.TryGetValue(name, out count)) + settingReadCounts[name] = count + 1; + else + settingReadCounts.Add(name, 1); + } } #endif #endregion /////////////////////////////////////////////////////////////////////