Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The PipeWriter 'ResponseBodyPipeWriter' does not implement PipeWriter.UnflushedBytes #108075

Open
vsfeedback opened this issue Sep 20, 2024 · 7 comments
Labels
area-System.IO.Pipelines untriaged New issue has not been triaged by the area owner

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


Microsoft Visual Studio Enterprise 2022 (64-bit) - Preview
Version 17.12.0 Preview 2.0
Solution: Minimal Web Api and Xunit (.NET 9.0.0-rc.1.24431.7)
WebApiXunit3.zip
The error:
The PipeWriter ‘ResponseBodyPipeWriter’ does not implement PipeWriter.UnflushedBytes

The same code works fine in .NET 8


Original Comments

Feedback Bot on 9/18/2024, 00:30 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Feedback Bot on 9/19/2024, 02:55 AM:

Thank you for sharing your feedback! Our teams prioritize action on product issues with broad customer impact. See details at: https://docs.microsoft.com/en-us/visualstudio/ide/report-a-problem#faq. In case you need answers to common questions or need assisted support, be sure to use https://visualstudio.microsoft.com/vs/support/. We’ll keep you posted on any updates to this feedback.

@mkArtakMSFT mkArtakMSFT transferred this issue from dotnet/aspnetcore Sep 20, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Sep 20, 2024
@mkArtakMSFT
Copy link
Member

@BrennanConroy FYI

@BrennanConroy
Copy link
Member

Update your Microsoft.AspNetCore.Mvc.Testing reference.

@Megasoft2
Copy link

Hi @BrennanConroy .

Now it works! with Microsoft.AspNetCore.Mvc.Testing 9.0.0-rc.1.24452.1

Thank you so much
Sincerely
Jorge

@WernerMairl
Copy link
Contributor

same situation here: got the exception => update to 9.0.0-rc.1.24452.1 => solved!
BR
Werner

@erenken
Copy link

erenken commented Nov 21, 2024

Unfortunately this didn't help me. I have a .NET 8 API project I wanted to convert to 9 and I get this error in my tests. I have tried the specific version and the release version of 9.0.0 and I still get the error. I have verified there aren't any nuget updates for this release or preview.

I did notice that I had to manually add Microsoft.Extensions.Caching.Memory with version 9.0.0 as something was still pointing to the pre-release version of it and it has a known vulnerability. I also see under Framework that it shows Microsoft.NETCore.App with version 9.0.0-rc.2.24473.5. I figure that should also not be an RC.

I guess for now I will stick with .NET 8.

This is what my CSPROJ looks like.

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net9.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <IsPackable>false</IsPackable>
    <IsTestProject>true</IsTestProject>
  </PropertyGroup>
  <ItemGroup>
    <None Remove="appsettings.json" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="appsettings.json">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="coverlet.collector" Version="6.0.2">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.0" />
    <PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
    <PackageReference Include="MSTest.TestAdapter" Version="3.6.3" />
    <PackageReference Include="MSTest.TestFramework" Version="3.6.3" />
    <PackageReference Include="NSubstitute" Version="5.3.0" />
    <PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.10.0" />
    <PackageReference Include="OpenTelemetry.Instrumentation.SqlClient" Version="1.9.0-beta.1" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\..\src\MY.API\MY.API.csproj" />
  </ItemGroup>
  <ItemGroup>
    <Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="OpenTelemetry\" />
  </ItemGroup>
</Project>

@craigb
Copy link

craigb commented Nov 27, 2024

This seems to be a breaking change when running net6 and net8 test code against the net9 runtime. Is that expected? I didn't see it called out in the NET9 release notes. I put a repro up at https://github.com/craigb/pipewriter-repro -- when you set RollForward to LatestMajor, it will use the net9 runtime and the code will break.

@davidfowl
Copy link
Member

That makes sense. .NET 9's JSON implementation relies on PipeWriter.UnflushedBytes.'s implementation. We should just document this breaking change if we haven't.

cc @Priya91 @eiriktsarpalis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.IO.Pipelines untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

8 participants