Skip to content

Commit 98b5fa6

Browse files
author
maximv
committed
fixed: #301 and releasing v4.3.1
1 parent a1dff77 commit 98b5fa6

File tree

7 files changed

+105
-4
lines changed

7 files changed

+105
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ DryIoc is fast, small, full-featured IoC Container for .NET
3030
- __DryIoc__ (source code) [![NuGet Badge](https://buildstats.info/nuget/DryIoc)](https://www.nuget.org/packages/DryIoc)
3131
- __DryIoc.Internal__ (source code with public types made internal) [![NuGet Badge](https://buildstats.info/nuget/DryIoc.Internal)](https://www.nuget.org/packages/DryIoc.Internal)
3232

33-
- [Release Notes](https://github.com/dadhi/DryIoc/releases/tag/v4.3.0) :: [Previous Versions](https://github.com/dadhi/DryIoc/blob/master/docs/DryIoc.Docs/VersionHistory.md)
33+
- [Release Notes](https://github.com/dadhi/DryIoc/releases/tag/v4.3.1) :: [Previous Versions](https://github.com/dadhi/DryIoc/blob/master/docs/DryIoc.Docs/VersionHistory.md)
3434
- [Extensions and Companions](Extensions.md)
3535
- [Documentation][WikiHome]
3636
- [Contribution guide](CONTRIBUTING.md)

docs/DryIoc.Docs/VersionHistory.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Version History
22
---------------
33

4+
## v4.3.1 Small feature and bug-fix release / 2020-08-07
5+
6+
- fixed: #301 breakage in scoped enumeration in v4
7+
48
## v4.3.0 Small feature and bug-fix release / 2020-07-31
59

610
- added: #298 Add RegisterManyIgnoreNoServicesWereRegistered

nuspecs/DryIoc.Internal.nuspec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
33
<metadata minClientVersion="3.3.0">
44
<id>DryIoc.Internal</id>
5-
<version>4.3.0</version>
5+
<version>4.3.1</version>
66

77
<authors>Maksim Volkau</authors>
88

@@ -15,6 +15,10 @@
1515
<tags>IoC Container Inversion-of-Control DI Dependency-Injection DRY Service-Provider Factory</tags>
1616
<releaseNotes>
1717
<![CDATA[
18+
## v4.3.1 Small feature and bug-fix release
19+
20+
- fixed: #301 breakage in scoped enumeration in v4
21+
1822
## v4.3.0 Small feature and bug-fix release
1923
2024
- added: #298 Add RegisterManyIgnoreNoServicesWereRegistered

nuspecs/DryIoc.nuspec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
33
<metadata minClientVersion="3.3.0">
44
<id>DryIoc</id>
5-
<version>4.3.0</version>
5+
<version>4.3.1</version>
66
<authors>Maksim Volkau</authors>
77
<copyright>Copyright © 2013-2020 Maksim Volkau</copyright>
88
<projectUrl>https://github.com/dadhi/DryIoc</projectUrl>
@@ -13,6 +13,10 @@
1313
<tags>IoC Container Inversion-of-Control DI Dependency-Injection DRY Service-Provider Factory</tags>
1414
<releaseNotes>
1515
<![CDATA[
16+
## v4.3.1 Small feature and bug-fix release
17+
18+
- fixed: #301 breakage in scoped enumeration in v4
19+
1620
## v4.3.0 Small feature and bug-fix release
1721
1822
- added: #298 Add RegisterManyIgnoreNoServicesWereRegistered

src/DryIoc/Container.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9762,8 +9762,10 @@ public virtual Expression GetExpressionOrDefault(Request request)
97629762
!request.IsResolutionRoot &&
97639763
!request.IsDirectlyWrappedInFunc() &&
97649764
!request.IsWrappedInFuncWithArgs() &&
9765+
!(request.Reuse.Name is IScopeName) &&
97659766
!setup.AsResolutionCall && // see #295
97669767
!setup.UseParentReuse &&
9768+
setup.Condition == null &&
97679769
!Made.IsConditional;
97689770

97699771
var reuse = request.Reuse;

src/DryIoc/DryIoc.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<TargetFrameworks Condition="'$(NoLegacy)' == 'true'">net45;netstandard1.0;netstandard1.3;netstandard2.0</TargetFrameworks>
66

77
<Product>DryIoc</Product>
8-
<VersionPrefix>4.3.0</VersionPrefix>
8+
<VersionPrefix>4.3.1</VersionPrefix>
99
<VersionSuffix></VersionSuffix>
1010

1111
<AssemblyName>$(Product)</AssemblyName>
@@ -17,6 +17,10 @@
1717
<PackageTags>IoC Container Inversion-of-Control DI Dependency-Injection DRY Service-Provider Factory FastExpressionCompiler ImTools</PackageTags>
1818
<PackageReleaseNotes>
1919
<![CDATA[
20+
## v4.3.1 Small feature and bug-fix release
21+
22+
- fixed: #301 breakage in scoped enumeration in v4
23+
2024
## v4.3.0 Small feature and bug-fix release
2125
2226
- added: #298 Add RegisterManyIgnoreNoServicesWereRegistered
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
using System.Collections.Generic;
2+
using System.Linq;
3+
using NUnit.Framework;
4+
5+
namespace DryIoc.IssuesTests
6+
{
7+
[TestFixture]
8+
public class GHIssue301_Breakage_in_scoped_enumeration_in_v4
9+
{
10+
[Test]
11+
public void Test()
12+
{
13+
var c = new Container();
14+
15+
c.RegisterMany<Mode1Comp>(Reuse.Transient, setup: Setup.With(openResolutionScope: true));
16+
c.RegisterMany<Mode2Comp>(Reuse.Transient, setup: Setup.With(openResolutionScope: true));
17+
18+
c.Register<IOoui, Ooui1>(Reuse.ScopedTo<IComp>(), setup: Setup.With(
19+
condition: req => req.Any(x => x.ServiceType == typeof(IMode1Comp))));
20+
21+
c.Register<IOoui, Ooui2>(Reuse.ScopedTo<IComp>(), setup: Setup.With(
22+
condition: req => req.Any(x => x.ServiceType == typeof(IMode2Comp))));
23+
24+
c.RegisterMany<OouiHost>(Reuse.ScopedTo<IComp>());
25+
26+
c.RegisterMany<Mode1>();
27+
c.RegisterMany<Mode2>();
28+
29+
var mode1 = c.Resolve<Mode1>();
30+
Assert.IsInstanceOf<Ooui1>(mode1.Comp.Oouis.Single());
31+
32+
var mode2 = c.Resolve<Mode2>();
33+
Assert.IsInstanceOf<Ooui2>(mode2.Comp.Oouis.Single());
34+
}
35+
36+
public interface IComp
37+
{
38+
IEnumerable<IOoui> Oouis { get; }
39+
}
40+
41+
public interface IOoui { }
42+
public class Ooui1 : IOoui { }
43+
public class Ooui2 : IOoui { }
44+
45+
public class OouiHost
46+
{
47+
public readonly IEnumerable<IOoui> Oouis;
48+
49+
public OouiHost(IEnumerable<IOoui> oouis) => Oouis = oouis;
50+
}
51+
52+
public interface IMode1Comp : IComp { }
53+
public interface IMode2Comp : IComp { }
54+
55+
public class Mode1Comp : IMode1Comp
56+
{
57+
public IEnumerable<IOoui> Oouis { get; }
58+
59+
public Mode1Comp(OouiHost host) => Oouis = host.Oouis;
60+
}
61+
62+
public class Mode2Comp : IMode2Comp
63+
{
64+
public IEnumerable<IOoui> Oouis { get; }
65+
66+
public Mode2Comp(OouiHost host) => Oouis = host.Oouis;
67+
}
68+
69+
public class Mode1
70+
{
71+
public IMode1Comp Comp { get; }
72+
73+
public Mode1(IMode1Comp comp) => Comp = comp;
74+
}
75+
76+
public class Mode2
77+
{
78+
public IMode2Comp Comp { get; }
79+
80+
public Mode2(IMode2Comp comp) => Comp = comp;
81+
}
82+
}
83+
}

0 commit comments

Comments
 (0)