You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dotnet run --project... has changed between .NET SDK 8.0.402 to 9.0.100 in how to passes through STDOUT from the executing project, such that the output is corrupted.
In the case of the OSS Nerdbank.Streams project, this change broke our testing of interop of an IPC protocol between a node.js process and the .NET 8 process.
The .NET 8 process writes binary to STDOUT. Specifically, it writes the 4 bytes [0x2f, 0xdf, 0x1d, 0x50] followed by the 16 bytes of a random GUID. This is a 'handshake' with the calling process, which in this case is node.js.
When invoking the .exe directly, or using the .NET 8.0.402 SDK's dotnet run command, I get valid binary output. I show it (the exe output) side-by-side with the dotnet run output of .NET 9 SDK, showing the corruption:
To Reproduce
git clone https://github.com/dotnet/Nerdbank.Streams.git
cd Nerdbank.Streams
git checkout 791ab523b3675aba0a4adb077b05216af253077d
dotnet build test/Nerdbank.Streams.Interop.Tests
cd src/nerdbank-streams
yarn
yarn test
(if you don't have yarn installed, use npm i -g yarn to acquire it)
Expected
All tests pass
Actual
Several interop tests fail with an 'unexpected magic number' error message.
Now all you have to do to correct it is go to global.json in the repo root and change the sdk back from 9.0.100 to 8.0.402 and it works fine.
Further technical details
The yarn test command runs a bunch of tests on node.js. Among them are interop tests which launch the .NET 8 test companion process using dotnet run --project:
Describe the bug
dotnet run --project
... has changed between .NET SDK 8.0.402 to 9.0.100 in how to passes through STDOUT from the executing project, such that the output is corrupted.In the case of the OSS Nerdbank.Streams project, this change broke our testing of interop of an IPC protocol between a node.js process and the .NET 8 process.
The .NET 8 process writes binary to STDOUT. Specifically, it writes the 4 bytes
[0x2f, 0xdf, 0x1d, 0x50]
followed by the 16 bytes of a random GUID. This is a 'handshake' with the calling process, which in this case is node.js.When invoking the .exe directly, or using the .NET 8.0.402 SDK's
dotnet run
command, I get valid binary output. I show it (the exe output) side-by-side with thedotnet run
output of .NET 9 SDK, showing the corruption:To Reproduce
(if you don't have yarn installed, use
npm i -g yarn
to acquire it)Expected
All tests pass
Actual
Several interop tests fail with an 'unexpected magic number' error message.
Now all you have to do to correct it is go to global.json in the repo root and change the sdk back from 9.0.100 to 8.0.402 and it works fine.
Further technical details
The
yarn test
command runs a bunch of tests on node.js. Among them are interop tests which launch the .NET 8 test companion process usingdotnet run --project
:https://github.com/dotnet/Nerdbank.Streams/blob/791ab523b3675aba0a4adb077b05216af253077d/src/nerdbank-streams/src/tests/MultiplexingStream.Interop.spec.ts#L33
I use this technique so I don't have to encode into the typescript test what the target framework is or otherwise where to find the .exe.
My workaround will be to go ahead and burn the relative path to the .exe and spawn that directly instead, I guess.
The text was updated successfully, but these errors were encountered: