From f1290a6862b18e87fd610c04d5e482902b6f9fdc Mon Sep 17 00:00:00 2001 From: Krzysztof Kozmic Date: Mon, 22 Jul 2013 07:55:30 +1000 Subject: [PATCH] getting build ready for v3.2.1 fixed compilation issues in .NET 3.5 and Silverlight 5 --- Changes.txt | 3 +++ src/Castle.Windsor.Tests/LifestyleTests.cs | 2 ++ .../Lifestyle/Scoped/CallContextLifetimeScope.cs | 11 +++++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Changes.txt b/Changes.txt index 9865396eb0..7fe68e4d44 100644 --- a/Changes.txt +++ b/Changes.txt @@ -1,5 +1,8 @@ +3.2.1 (2013-07-22) +================== - fixed IOC-349 - SerializationException — Type is not resolved for member "Castle.MicroKernel.Lifestyle.Scoped.CallContextLifetimeScope+SerializationReference, ... + 3.2.0 (2013-02-16) ================== - implemented IOC-375 - List duplicate registrations that are registered through convention diff --git a/src/Castle.Windsor.Tests/LifestyleTests.cs b/src/Castle.Windsor.Tests/LifestyleTests.cs index bd32e869ed..ed7592759a 100644 --- a/src/Castle.Windsor.Tests/LifestyleTests.cs +++ b/src/Castle.Windsor.Tests/LifestyleTests.cs @@ -67,7 +67,9 @@ public class InterfaceImpl : IInterface, IDisposable public void Dispose() { disposed = true; +#if !SILVERLIGHT Console.WriteLine(new StackTrace(true)); +#endif } public void Do() diff --git a/src/Castle.Windsor/MicroKernel/Lifestyle/Scoped/CallContextLifetimeScope.cs b/src/Castle.Windsor/MicroKernel/Lifestyle/Scoped/CallContextLifetimeScope.cs index f25536d025..cd27e711e9 100644 --- a/src/Castle.Windsor/MicroKernel/Lifestyle/Scoped/CallContextLifetimeScope.cs +++ b/src/Castle.Windsor/MicroKernel/Lifestyle/Scoped/CallContextLifetimeScope.cs @@ -40,7 +40,7 @@ namespace Castle.MicroKernel.Lifestyle.Scoped public class CallContextLifetimeScope : ILifetimeScope { #if DOTNET35 - private static readonly object locker = new object(); + private static readonly object cacheLocker = new object(); private static readonly Dictionary appDomainLocalInstanceCache = new Dictionary(); #else @@ -62,8 +62,15 @@ public CallContextLifetimeScope(IKernel container) parentScope = parent; } contextId = Guid.NewGuid(); +#if DOTNET35 + lock(cacheLocker) + { + appDomainLocalInstanceCache.Add(contextId, this); + } +#else var added = appDomainLocalInstanceCache.TryAdd(contextId, this); Debug.Assert(added); +#endif SetCurrentScope(this); } @@ -94,7 +101,7 @@ public void Dispose() } } #if DOTNET35 - lock (locker) + lock (cacheLocker) { appDomainLocalInstanceCache.Remove(contextId); }