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

TestWriteAfterExit fails on .NET 8 #117

Open
Bartleby2718 opened this issue May 20, 2024 · 1 comment
Open

TestWriteAfterExit fails on .NET 8 #117

Bartleby2718 opened this issue May 20, 2024 · 1 comment

Comments

@Bartleby2718
Copy link

Explanation of the Bug

The test TestWriteAfterExit is affected by a breaking change in .NET 8: FileStream writes when pipe is closed.

Reproduction steps

  1. Target net8.0 in MedallionShell.Tests.csproj and in SampleCommand.csproj
  2. Run TestWriteAfterExit targeting net8.0

Full error output

 TestWriteAfterExit
No source available
 Duration: 158 ms

Message: 
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

@madelson
Copy link
Owner

We should fix this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants