Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
cf10b13
Remove net6.0 target in favor of net8.0. Update Changes.md. Update ve…
Dec 18, 2025
1c6d8d7
Bump NUnit3TestAdapter from 6.0.0 to 6.1.0 (#411)
dependabot[bot] Jan 12, 2026
6c9654a
Bump Microsoft.SourceLink.GitHub from 8.0.0 to 10.0.103 (#414)
dependabot[bot] Feb 12, 2026
784c384
Switch MemoryStreamDoubleDispose event level from Critical to Verbose…
inklesspen1rus Feb 12, 2026
540a934
Bump Microsoft.NET.Test.Sdk from 18.0.1 to 18.3.0 (#417)
dependabot[bot] Feb 26, 2026
3eeaa5a
Bump actions/upload-artifact from 6 to 7 (#418)
dependabot[bot] Apr 24, 2026
93a3c28
Bump NUnit.Analyzers from 4.11.2 to 4.12.0 (#420)
dependabot[bot] Apr 24, 2026
ef979f7
Bump NUnit3TestAdapter from 6.1.0 to 6.2.0 (#424)
dependabot[bot] Apr 24, 2026
aad21cb
Bump Microsoft.NET.Test.Sdk from 18.3.0 to 18.4.0 (#425)
dependabot[bot] Apr 27, 2026
22f2f76
Bump Microsoft.SourceLink.GitHub from 10.0.103 to 10.0.203 (#429)
dependabot[bot] Apr 27, 2026
e6db6fa
Bump Microsoft.NET.Test.Sdk from 18.4.0 to 18.5.1 (#430)
dependabot[bot] Apr 29, 2026
be7ddc7
Update CHANGES.md
benmwatson Apr 29, 2026
80cdf9b
Update CHANGES.md
benmwatson Apr 29, 2026
870f920
Bump Microsoft.SourceLink.GitHub from 10.0.203 to 10.0.300 (#433)
dependabot[bot] Jul 6, 2026
fd061e6
Bump actions/checkout from 6 to 7 (#439)
dependabot[bot] Jul 6, 2026
fb7a6a8
Bump Microsoft.NET.Test.Sdk from 18.5.1 to 18.6.0 (#435)
dependabot[bot] Jul 6, 2026
c67eaaa
Update workflows to use flexible .NET versions. (#431)
benmwatson Jul 10, 2026
151d4dd
Bump NUnit from 4.4.0 to 4.5.1 (#419)
dependabot[bot] Jul 10, 2026
899c40b
Resolve PR comments, update version, documentation.
Jul 10, 2026
0fbca21
Bump NUnit.Analyzers from 4.12.0 to 4.14.0 (#436)
dependabot[bot] Jul 13, 2026
d87c681
Bump dotnet-sdk from 8.0.416 to 8.0.422 (#437)
dependabot[bot] Jul 13, 2026
cc74e97
Remove net6.0 target in favor of net8.0. Update Changes.md. Update ve…
Dec 18, 2025
bea598f
Update CHANGES.md
benmwatson Apr 29, 2026
34b170b
Update CHANGES.md
benmwatson Apr 29, 2026
5a5f502
Resolve PR comments, update version, documentation.
Jul 10, 2026
2ba03ae
Merge branch 'drop_net6' of https://github.com/microsoft/Microsoft.IO…
Jul 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
name: Run Benchmark.Net
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.100
dotnet-version: 8.0.x
- name: Run benchmark
run: cd BenchmarkTests && dotnet run -c Release --framework net8.0 --exporters json --filter '*'

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v7

# Tooling setup

- name: Install .NET SDK
uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.100
dotnet-version: 8.0.x

# Build and test validation

Expand All @@ -38,7 +38,7 @@ jobs:
--no-build

- name: Upload test results as pipeline artifact
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@v7
with:
name: Test results
path: 'Test results/'
Expand All @@ -65,7 +65,7 @@ jobs:
}

- name: Upload publish output as pipeline artifact
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@v7
with:
name: Publish outputs
path: 'Publish outputs/'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.100
dotnet-version: 8.0.x

- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v7

- name: Initialize CodeQL
uses: github/codeql-action/init@v4
Expand Down
9 changes: 9 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Version 4.0.0

**Breaking Changes**
* Dropping net6.0 will more easily support trimming [PR #409](https://github.com/microsoft/Microsoft.IO.RecyclableMemoryStream/pull/409)
* Switch `MemoryStreamDoubleDispose` event level from Critical to Verbose [PR #406](https://github.com/microsoft/Microsoft.IO.RecyclableMemoryStream/pull/406)

**Other Changes**
* Readme: Add clarity for the large pool of buffers and the GetBuffer method pertaining to the .NET max array length [PR #370](https://github.com/microsoft/Microsoft.IO.RecyclableMemoryStream/pull/370)

Comment thread
benmwatson marked this conversation as resolved.
# Version 3.0.1

**Bug Fix**
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ You can optionally configure the `RecyclableStreamManager.ThrowExceptionOnToArra
| -----|-------|-------------|
| MemoryStreamCreated | Verbose | Logged every time a stream object is allocated. Fields: `guid`, `tag`, `requestedSize`, `actualSize`. |
| MemoryStreamDisposed | Verbose | Logged every time a stream object is disposed. Fields: `guid`, `tag`, `allocationStack`, `disposeStack`. |
| MemoryStreamDoubleDispose | Critical | Logged if a stream is disposed more than once. This indicates a logic error by the user of the stream. Dispose should happen exactly once per stream to avoid resource usage bugs. Fields: `guid`, `tag`, `allocationStack`, `disposeStack1`, `disposeStack2`. |
| MemoryStreamDoubleDispose | Verbose | Logged if a stream is disposed more than once. This indicates a logic error by the user of the stream. Dispose should happen exactly once per stream to avoid resource usage bugs. Fields: `guid`, `tag`, `allocationStack`, `disposeStack1`, `disposeStack2`. |
| MemoryStreamFinalized | Error | Logged if a stream has gone out of scope without being disposed. This indicates a resource leak. Fields: `guid`, `tag`, `allocationStack`.|
| MemoryStreamToArray | Verbose | Logged whenever `ToArray` is called. This indicates a potential problem, as calling `ToArray` goes against the concepts of good memory practice which `RecyclableMemoryStream` is trying to solve. Fields: `guid`, `tag`, `stack`, `size`.|
| MemoryStreamManagerInitialized| Informational | Logged when the `RecyclableMemoryStreamManager` is initialized. Fields: `blockSize`, `largeBufferMultiple`, `maximumBufferSize`.|
Expand Down
5 changes: 2 additions & 3 deletions UnitTests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4057,9 +4057,8 @@ protected override void TestDroppingLargeBuffer(long maxFreeLargeBufferSize)
}
}
}
#pragma warning disable 618 // Timeout is obsolete because it kills the thread, which isn't allowed, but it's still handy
// for tests that are expected to run indefinitely in the failure case.
[Test, Timeout(10000)]

[Test, MaxTime(10000)]
public void TryGetBuffer_InfiniteLoop_Issue344()
{
// see https://github.com/microsoft/Microsoft.IO.RecyclableMemoryStream/issues/344
Expand Down
8 changes: 4 additions & 4 deletions UnitTests/UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<NoWarn>NUnit2045</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="nunit" Version="4.4.0" />
<PackageReference Include="NUnit3TestAdapter" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="NUnit.Analyzers" Version="4.11.2" PrivateAssets="All" />
<PackageReference Include="nunit" Version="4.5.1" />
<PackageReference Include="NUnit3TestAdapter" Version="6.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.6.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.14.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\src\Microsoft.IO.RecyclableMemoryStream.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.416",
"version": "8.0.422",
"rollForward": "latestMinor"
}
}
2 changes: 1 addition & 1 deletion src/Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void MemoryStreamDisposed(Guid guid, string? tag, long lifetimeMs, string
/// <param name="disposeStack1">Call stack of the first dispose.</param>
/// <param name="disposeStack2">Call stack of the second dispose.</param>
/// <remarks>Note: Stacks will only be populated if RecyclableMemoryStreamManager.GenerateCallStacks is true.</remarks>
[Event(3, Level = EventLevel.Critical)]
[Event(3, Level = EventLevel.Verbose)]
public void MemoryStreamDoubleDispose(Guid guid, string? tag, string? allocationStack, string? disposeStack1,
string? disposeStack2)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Microsoft.IO.RecyclableMemoryStream.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0</TargetFrameworks>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RootNamespace>Microsoft.IO</RootNamespace>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\Microsoft.IO.RecyclableMemoryStream.xml</DocumentationFile>
<!-- NuGet properties -->
<PackageId>Microsoft.IO.RecyclableMemoryStream</PackageId>
<PackageVersion>3.0.1</PackageVersion>
<PackageVersion>4.0.0-alpha</PackageVersion>
<Title>Microsoft.IO.RecyclableMemoryStream</Title>
<Authors>Microsoft</Authors>
<Description>A pooled MemoryStream allocator to decrease GC load and improve performance on highly scalable systems.</Description>
Expand Down Expand Up @@ -43,7 +43,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.300" PrivateAssets="All" />
<PackageReference Include="System.Memory" Version="4.6.3" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.0.1.0")]
[assembly: AssemblyFileVersion("3.0.1.0")]
[assembly: AssemblyVersion("4.0.0.0")]
[assembly: AssemblyFileVersion("4.0.0.0")]

[assembly: CLSCompliant(true)]

Expand Down
2 changes: 1 addition & 1 deletion src/RecyclableMemoryStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ protected override void Dispose(bool disposing)
if (this.disposed)
{
string? doubleDisposeStack = null;
if (this.memoryManager.options.GenerateCallStacks)
if (this.memoryManager.GenerateDoubleDisposedStackTrace)
{
doubleDisposeStack = Environment.StackTrace;
}
Expand Down
8 changes: 8 additions & 0 deletions src/RecyclableMemoryStreamManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace Microsoft.IO
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using System.Runtime.CompilerServices;
using System.Threading;

Expand Down Expand Up @@ -82,6 +83,13 @@ public partial class RecyclableMemoryStreamManager

internal readonly Options options;

internal bool GenerateDoubleDisposedStackTrace =>
this.options.GenerateCallStacks &&
(
this.StreamDoubleDisposed != null ||
Events.Writer.IsEnabled(EventLevel.Verbose, EventKeywords.None)
);

/// <summary>
/// Settings for controlling the behavior of RecyclableMemoryStream
/// </summary>
Expand Down
Loading