Skip to content

Commit

Permalink
getting build ready for v3.2.1
Browse files Browse the repository at this point in the history
fixed compilation issues in .NET 3.5 and Silverlight 5
  • Loading branch information
kkozmic committed Jul 21, 2013
1 parent b6bcf66 commit f1290a6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions 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, ... - fixed IOC-349 - SerializationException � Type is not resolved for member "Castle.MicroKernel.Lifestyle.Scoped.CallContextLifetimeScope+SerializationReference, ...



3.2.0 (2013-02-16) 3.2.0 (2013-02-16)
================== ==================
- implemented IOC-375 - List duplicate registrations that are registered through convention - implemented IOC-375 - List duplicate registrations that are registered through convention
Expand Down
2 changes: 2 additions & 0 deletions src/Castle.Windsor.Tests/LifestyleTests.cs
Expand Up @@ -67,7 +67,9 @@ public class InterfaceImpl : IInterface, IDisposable
public void Dispose() public void Dispose()
{ {
disposed = true; disposed = true;
#if !SILVERLIGHT
Console.WriteLine(new StackTrace(true)); Console.WriteLine(new StackTrace(true));
#endif
} }


public void Do() public void Do()
Expand Down
Expand Up @@ -40,7 +40,7 @@ namespace Castle.MicroKernel.Lifestyle.Scoped
public class CallContextLifetimeScope : ILifetimeScope public class CallContextLifetimeScope : ILifetimeScope
{ {
#if DOTNET35 #if DOTNET35
private static readonly object locker = new object(); private static readonly object cacheLocker = new object();
private static readonly Dictionary<Guid, CallContextLifetimeScope> appDomainLocalInstanceCache = private static readonly Dictionary<Guid, CallContextLifetimeScope> appDomainLocalInstanceCache =
new Dictionary<Guid, CallContextLifetimeScope>(); new Dictionary<Guid, CallContextLifetimeScope>();
#else #else
Expand All @@ -62,8 +62,15 @@ public CallContextLifetimeScope(IKernel container)
parentScope = parent; parentScope = parent;
} }
contextId = Guid.NewGuid(); contextId = Guid.NewGuid();
#if DOTNET35
lock(cacheLocker)
{
appDomainLocalInstanceCache.Add(contextId, this);
}
#else
var added = appDomainLocalInstanceCache.TryAdd(contextId, this); var added = appDomainLocalInstanceCache.TryAdd(contextId, this);
Debug.Assert(added); Debug.Assert(added);
#endif
SetCurrentScope(this); SetCurrentScope(this);
} }


Expand Down Expand Up @@ -94,7 +101,7 @@ public void Dispose()
} }
} }
#if DOTNET35 #if DOTNET35
lock (locker) lock (cacheLocker)
{ {
appDomainLocalInstanceCache.Remove(contextId); appDomainLocalInstanceCache.Remove(contextId);
} }
Expand Down

0 comments on commit f1290a6

Please sign in to comment.