diagnostics icon indicating copy to clipboard operation
diagnostics copied to clipboard

Unhandled exception. System.IO.EndOfStreamException: Unable to read beyond the end of the stream.

Open Evangelink opened this issue 1 year ago • 5 comments

Description

We are trying to enable macos pipeline for our new testing platform and we are getting quite a lot of our acceptance tests related to dump creation failing. See https://github.com/microsoft/testfx/pull/4155

One of the issue is:

Unhandled exception. System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
   at System.IO.BinaryReader.ReadUInt16()
   at Microsoft.Diagnostics.NETCore.Client.IpcHeader.Parse(BinaryReader reader)
   at Microsoft.Diagnostics.NETCore.Client.IpcMessage.Parse(Stream stream)
   at Microsoft.Diagnostics.NETCore.Client.IpcClient.Read(Stream stream)
   at Microsoft.Diagnostics.NETCore.Client.IpcClient.SendMessageGetContinuation(IpcEndpoint endpoint, IpcMessage message)
   at Microsoft.Diagnostics.NETCore.Client.IpcClient.SendMessage(IpcEndpoint endpoint, IpcMessage message)
   at Microsoft.Diagnostics.NETCore.Client.DiagnosticsClient.WriteDump(DumpType dumpType, String dumpPath, WriteDumpFlags flags)
   at Microsoft.Diagnostics.NETCore.Client.DiagnosticsClient.WriteDump(DumpType dumpType, String dumpPath, Boolean logDumpGeneration)
   at Microsoft.Testing.Extensions.Diagnostics.HangDumpProcessLifetimeHandler.TakeDumpAsync() in /_/src/Platform/Microsoft.Testing.Extensions.HangDump/HangDumpProcessLifetimeHandler.cs:line 375
   at Microsoft.Testing.Extensions.Diagnostics.HangDumpProcessLifetimeHandler.ActivityTimerAsync() in /_/src/Platform/Microsoft.Testing.Extensions.HangDump/HangDumpProcessLifetimeHandler.cs:line 318
   at Microsoft.Testing.Platform.Helpers.SystemTask.<>c__DisplayClass4_0.<RunLongRunning>b__0() in /_/src/Platform/Microsoft.Testing.Platform/Helpers/System/SystemTask.cs:line 33
   at System.Threading.Thread.StartCallback()
Test suite failed with and exit code different that 2 (failed tests). Failure related to an unexpected condition. Exit code '134'

Configuration

We are using macos-latest on AzDO hosted pool.

Regression?

No idea, we are enabling macos. We recently bumped to 0.2.553101, I'll try to downgrade and see if that changes anything.

Evangelink avatar Nov 26 '24 10:11 Evangelink

@mikem8361

tommcdon avatar Dec 02 '24 16:12 tommcdon

Downgrading didn't help

Evangelink avatar Dec 02 '24 18:12 Evangelink

@mikem8361 is there any plan or update around this please? We have another report of this failing on MacOS. https://github.com/microsoft/testfx/issues/5157#issuecomment-2693991606

Which prevents the user from getting dumps on MacOS and makes developing their testing framework (TUnit) harder.

We are still using version: <PackageVersion Include="Microsoft.Diagnostics.NETCore.Client" Version="0.2.553101" />

https://github.com/microsoft/testfx/blob/main/Directory.Packages.props#L49

nohwnd avatar Mar 03 '25 16:03 nohwnd

@nohwnd We apologize for the delay! This issue is on our backlog, but until we have time to get to this issue, would it be possible to try updating to the latest released version of the net core client? https://github.com/dotnet/diagnostics/releases/tag/v9.0.607501. If that doesn't work, would it be possible to provide a small, reproducible test case we can use for investigation?

tommcdon avatar Mar 03 '25 17:03 tommcdon

Still errors with an explicit reference to that package.

This repo can reproduce it: https://github.com/thomhurst/Microsoft.Testing.Platform.Reproductions/tree/d3e879aa41ccfd7973c0e129062a1ccc8b4114d1

thomhurst avatar Mar 04 '25 09:03 thomhurst

How do I use the above repo to reproduction this issue? It only happens on MacOS? What version(s) of .NET is the target process running? I don't know for sure, but I think the older version of the client assembly is still being used because Microsoft.Testing.Extensions.HangDump references it even though the above project has a reference to the newer client version.

mikem8361 avatar Apr 08 '25 00:04 mikem8361

@mikem8361 The extension is targeting that version (https://github.com/microsoft/testfx/blob/61be9047fc4a92b2b8223271d88c718664145adf/Directory.Packages.props#L50), but the issue still happens. It's reproducible in CI at least on an app targeting net9.0

Youssef1313 avatar Apr 29 '25 03:04 Youssef1313

Any chance to have someone looking into this issue?

Evangelink avatar Jul 16 '25 09:07 Evangelink