Skip to content

.NET 9.0.100 SDK update broke our interop tests with node.js #44940

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

Closed
AArnott opened this issue Nov 19, 2024 · 3 comments
Closed

.NET 9.0.100 SDK update broke our interop tests with node.js #44940

AArnott opened this issue Nov 19, 2024 · 3 comments
Labels
Area-CLI untriaged Request triage from a team member

Comments

@AArnott
Copy link
Contributor

AArnott commented Nov 19, 2024

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 the dotnet run output of .NET 9 SDK, showing the corruption:

Image

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:

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.

@ghost ghost added Area-dotnet test untriaged Request triage from a team member labels Nov 19, 2024
AArnott added a commit to dotnet/Nerdbank.Streams that referenced this issue Nov 19, 2024
This is a workaround for a breaking change in the .NET 9 SDK, as documented at dotnet/sdk#44940.
@huoyaoyuan
Copy link
Member

Should be another case of dotnet/msbuild#10998?

@nohwnd
Copy link
Member

nohwnd commented Nov 19, 2024

Looks like an instance of the linked issue.

@AArnott
Copy link
Contributor Author

AArnott commented Nov 19, 2024

Agreed. This is a dupe.

@AArnott AArnott closed this as not planned Won't fix, can't repro, duplicate, stale Nov 19, 2024
AArnott added a commit to dotnet/Nerdbank.Streams that referenced this issue Nov 19, 2024
This is a workaround for a breaking change in the .NET 9 SDK, as documented at dotnet/sdk#44940.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-CLI untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

3 participants