Skip to content

Commit

Permalink
- fixed IOC-320 - System.ArgumentNullException at Castle.MicroKernel.…
Browse files Browse the repository at this point in the history
…Burden.Release(IReleasePolicy policy)
  • Loading branch information
kkozmic committed Nov 19, 2011
1 parent b86d0da commit 60367ab
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
1 change: 1 addition & 0 deletions Changes.txt
Expand Up @@ -4,6 +4,7 @@
- implemented IOC-313 - Add event to be raised by the container whenever empty collection is being resolved
- implemented IOC-312 - Add shortcut methods to API to register types from given namespace

- fixed IOC-320 - System.ArgumentNullException at Castle.MicroKernel.Burden.Release(IReleasePolicy policy)
- fixed IOC-315 - ResolveAll should not ignore generic constraint violations on dependencies of resolved component
- fixed IOC-314 - Parsing container configuration uses the current culture
- fixed IOC-311 - OptimizeDependencyResolutionDisposable eats exceptions thrown during installation
Expand Down
Expand Up @@ -18,7 +18,6 @@ namespace CastleTests.Lifecycle

using Castle.MicroKernel.Registration;
using Castle.MicroKernel.Tests.ClassComponents;
using Castle.MicroKernel.Tests.Lifestyle;
using Castle.MicroKernel.Tests.Pools;

using CastleTests.Components;
Expand Down Expand Up @@ -122,10 +121,6 @@ public class DisposableTemplateEngine : DisposableBase
{
}

public class EmptyClass
{
}

[Test]
public void ComponentsAreOnlyDisposedOnce()
{
Expand Down Expand Up @@ -259,5 +254,22 @@ public void WhenRootComponentIsNotDisposableButThirdLevelDependenciesAre_Depende
Assert.IsTrue(instance1.FakeRoot.A.IsDisposed);
Assert.IsTrue(instance1.FakeRoot.B.IsDisposed);
}

[Test]
[Bug("IOC-320")]
public void Expected_exception_during_creation_doesnt_prevent_from_being_released_properly()
{
Container.Register(Component.For<GenA<int>>().LifestyleTransient(),
Component.For<B>().UsingFactoryMethod<B>(delegate
{
throw new NotImplementedException("boo hoo!");
}).LifestyleTransient()
.OnDestroy(Assert.IsNotNull));

var a = Container.Resolve<GenA<int>>();

Container.Release(a);
}

}
}
4 changes: 4 additions & 0 deletions src/Castle.Windsor/MicroKernel/Context/CreationContext.cs
Expand Up @@ -384,6 +384,10 @@ private void ExitResolutionContext(Burden burden, bool trackContext)
{
return;
}
if (burden.Instance == null)
{
return;
}
if (burden.RequiresPolicyRelease == false)
{
return;
Expand Down

0 comments on commit 60367ab

Please sign in to comment.