Skip to content

Commit c6b7098

Browse files
committed
#34 - identified the source of the stack overflow
1 parent b711f52 commit c6b7098

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

SubSonic.Core.Abstractions/SubSonic.Core.Abstractions.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<Authors>Kenneth Carter</Authors>
77
<Version>4.1.0-alpha.1</Version>
88
<SignAssembly>true</SignAssembly>
9+
<IncludeSymbols>true</IncludeSymbols>
10+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
911
<AssemblyOriginatorKeyFile>SubSonicStrongName.snk</AssemblyOriginatorKeyFile>
1012
<PackageLicenseFile>LICENSE.MD</PackageLicenseFile>
1113
</PropertyGroup>

SubSonic.Tests/DAL/ExtensionMethod/PagingExtensionMethodTests.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,21 @@ public async Task ShouldBeAbleToEnumeratePagedDataAsync()
8787
recordCount = People.Count(),
8888
pageSize = 10,
8989
pageCount = (int)Math.Ceiling((decimal)recordCount / pageSize),
90-
count = 0;
90+
cnt = 0,
91+
pageCnt = 0;
9192

9293
foreach (var page in Context.People.ToPagedCollection(pageSize).GetPages())
9394
{
94-
await foreach(Person person in page)
95+
pageCnt++;
96+
97+
await foreach (Person person in page)
9598
{
96-
count++;
99+
cnt++;
97100
}
98101
}
99102

100-
count.Should().Be(recordCount);
103+
pageCnt.Should().Be(pageCount);
104+
cnt.Should().Be(recordCount);
101105
}
102106
}
103107
}

SubSonic/Database/DbPageCollection.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Data;
66
using System.Data.Common;
77
using System.Globalization;
8+
using System.Runtime.CompilerServices;
89
using System.Text;
910
using System.Threading;
1011
using System.Threading.Tasks;
@@ -107,7 +108,7 @@ IEnumerator IEnumerable.GetEnumerator()
107108
}
108109

109110
#if NETSTANDARD2_0
110-
public IAsyncEnumerator<TEntity> GetAsyncEnumerator(CancellationToken cancellationToken = default)
111+
IAsyncEnumerator<TEntity> IAsyncEnumerable<TEntity>.GetAsyncEnumerator(CancellationToken cancellationToken)
111112
{
112113
return new Dasync.Collections.AsyncEnumerable<TEntity>(async yield =>
113114
{
@@ -116,14 +117,15 @@ public IAsyncEnumerator<TEntity> GetAsyncEnumerator(CancellationToken cancellati
116117
await yield.ReturnAsync(entity).ConfigureAwait(false);
117118
}
118119
}).GetAsyncEnumerator(cancellationToken);
120+
}
119121
#elif NETSTANDARD2_1
120-
public async IAsyncEnumerator<TEntity> GetAsyncEnumerator(CancellationToken cancellationToken = default)
122+
async IAsyncEnumerator<TEntity> IAsyncEnumerable<TEntity>.GetAsyncEnumerator(CancellationToken cancellationToken)
121123
{
122-
await foreach(TEntity entity in this.WithCancellation(cancellationToken))
124+
foreach(TEntity entity in this)
123125
{
124126
yield return entity;
125127
}
126-
#endif
127128
}
129+
#endif
128130
}
129131
}

0 commit comments

Comments
 (0)