-
Notifications
You must be signed in to change notification settings - Fork 31
Description
Explanation of the Bug
The test TestWriteAfterExit is affected by a breaking change in .NET 8: FileStream writes when pipe is closed.
Reproduction steps
- Target
net8.0inMedallionShell.Tests.csprojand inSampleCommand.csproj - Run
TestWriteAfterExittargetingnet8.0
Full error output
TestWriteAfterExit
No source available
Duration: 158 msMessage:
should run on current platform
Expected: No Exception to be thrown
But was: <System.IO.IOException: The pipe is being closed.
at System.IO.RandomAccess.WriteAtOffset(SafeFileHandle handle, ReadOnlySpan`1 buffer, Int64 fileOffset)
at System.IO.Strategies.OSFileStreamStrategy.Write(ReadOnlySpan`1 buffer)
at System.IO.Strategies.OSFileStreamStrategy.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.Strategies.BufferedFileStreamStrategy.Flush(Boolean flushToDisk)
at Medallion.Shell.Streams.ProcessStreamWrapper.<>c.b__22_0(Stream s, Boolean ) in //MedallionShell/Streams/ProcessStreamWrapper.cs:line 49
at Medallion.Shell.Streams.ProcessStreamWrapper.DoWriteOperation[TArg](TArg arg, Action`2 action) in //MedallionShell/Streams/ProcessStreamWrapper.cs:line 155
at Medallion.Shell.Streams.ProcessStreamWrapper.Flush() in //MedallionShell/Streams/ProcessStreamWrapper.cs:line 49
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at System.IO.StreamWriter.Write(Char[] buffer)
at Medallion.Shell.Streams.ProcessStreamWriter.WriteLine() in /_/MedallionShell/Streams/ProcessStreamWriter.cs:line 294
at SampleCommand.PlatformCompatibilityTests.TestWriteAfterExit() in C:\Users\bartl\Documents\GitHub\MedallionShell\SampleCommand\PlatformCompatibilityTests.cs:line 58
at Medallion.Shell.Tests.PlatformCompatibilityTest.<>c__DisplayClass10_0.b__0() in C:\Users\bartl\Documents\GitHub\MedallionShell\MedallionShell.Tests\PlatformCompatibilityTest.cs:line 51
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
--- End of stack trace from previous location ---
at NUnit.Framework.Internal.ExceptionHelper.Rethrow(Exception exception)
at NUnit.Framework.Internal.Reflect.DynamicInvokeWithTransparentExceptions(Delegate delegate)
at NUnit.Framework.Internal.ExceptionHelper.RecordException(Delegate parameterlessDelegate, String parameterName)>Stack Trace:
PlatformCompatibilityTest.RunTestAsync(Expression`1 testMethod) line 51
GenericAdapter`1.GetResult()
AsyncToSyncAdapter.Await(Func`1 invoke)
TestMethodCommand.RunTestMethod(TestExecutionContext context)
TestMethodCommand.Execute(TestExecutionContext context)
<>c__DisplayClass4_0.b__0()
<>c__DisplayClass1_0`1.b__0(Object _)
1) at Medallion.Shell.Tests.PlatformCompatibilityTest.RunTestAsync(Expression`1 testMethod) in C:\Users\bartl\Documents\GitHub\MedallionShell\MedallionShell.Tests\PlatformCompatibilityTest.cs:line 51
AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
PlatformCompatibilityTest.RunTestAsync(Expression`1 testMethod)
PlatformCompatibilityTest.TestWriteAfterExit() line 22