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

[BUG] Command '.NET:New Project...' resulted in an error Stream terminated before required bytes where read. #1157

Closed
bwulms opened this issue May 30, 2024 · 7 comments
Labels
area-solution Solution explorer bug Something isn't working mac MacOS

Comments

@bwulms
Copy link

bwulms commented May 30, 2024

Describe the Issue

I installed Visual Studio Code, C# Dev Kit and .NET SDK 8.0 on a new Macbook Air with M3.

I followed the steps as described at https://code.visualstudio.com/docs/csharp/get-started.

When I want to create a new project using .NET: New Project... command I get the following error:

Command '.NET:New Project...' resulted in an error
Stream terminated before required bytes where read.

Steps To Reproduce

There is no output in the debug console

Expected Behavior

I expect to be able to create a new C# project.

Environment Information

  • OS: macOS 14.5
  • Visual Studio Code 1.89.1
  • C# Dev Kit extension v.1.6.8
  • C# extension v2.31.19
  • .NET Install Tool extension v.2.0.5
@bwulms bwulms added the bug Something isn't working label May 30, 2024
@bwulms bwulms changed the title [BUG] <titleCommand '.NET:New Project...' resulted in an error Stream terminated before required bytes where read.> [BUG] Command '.NET:New Project...' resulted in an error Stream terminated before required bytes where read. May 30, 2024
@smitpatel
Copy link
Member

@bwulms - Thanks for reporting this issue. Can you answer few questions to help us investigate the root cause?

  1. Does this happen always or sometimes only?
  2. Does this happen to any template or when creating project using particular template only?
  3. Can you share logs from output window in VS Code. There would be category C# dev kit which will have logs for this extension.
  4. Can you share how is the error reported?

@smitpatel smitpatel added the area-templates Experiences around the project/item templates label May 30, 2024
@bwulms
Copy link
Author

bwulms commented May 31, 2024

  1. This happens always
  2. It happens when I go the the command window (shitf-command-p), type .NET: New pro to filter en then select the command '.NET: New Project...'. At this point I get a popup dialog with the error message mentioned above. Note that there is no selection option for a particular template.
  3. At this point there is no output in the output window in VS Code, als not for the C# dev extension.
  4. The error is reported in a popup dialog.

I also tried the following:
From the VS Code terminal window I gave the following commands:
dotnet new console
dotnet new sln

This created a simple console project and a solution file.
When I select this solution file in VS Code and click the blue 'Open Solution' button in the Solution Explorer I get the following error in the output window for the C# dev extension:

Failed at 'Open a solution' (1ms) with error: SolutionOpenError: Run into errors while opening the solution: Error: Stream terminated before required bytes were read.
Starting Open a solution...
Starting Open a solution with environment service...
Starting Clear environment...
Failed at 'Clear environment' (0ms) with error: Error: Stream terminated before required bytes were read.
Failed at 'Open a solution with environment service' (0ms) with error: Error: Stream terminated before required bytes were read.
Failed at 'Open a solution' (1ms) with error: SolutionOpenError: Run into errors while opening the solution: Error: Stream terminated before required bytes were read.

Please let me know If you need additional information.

@smitpatel
Copy link
Member

@bwulms - Thanks for information.

@lifengl - Looking at the same error occurring open solution, looks like it is not related to particular action but something fundamentally erroring in extension activation. Perhaps some issue with creating RPC calls. I also found #679 which has same error. Any ideas how to recover from this error or what else is needed for investigation?

@smitpatel smitpatel added area-solution Solution explorer mac MacOS and removed area-templates Experiences around the project/item templates labels May 31, 2024
@bwulms
Copy link
Author

bwulms commented Jun 2, 2024

The problem has been solved. It was caused by the migrate of my old mac (intel based) to my new mac (apple silicon). When I opened an existing solution I noticed the following error message in the C# Dev extension:

.NET server STDERR: Failed to load /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.18/libhostpolicy.dylib, error: dlopen(/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.18/libhostpolicy.dylib, 0x0001): tried: '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.18/libhostpolicy.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.18/libhostpolicy.dylib' (no such file), '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.18/libhostpolicy.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))

Apparently the migration tool also migrated the installed dotnet versions of my old mac.

To solve the problem I removed the directory /usr/local/share/dotnet completely and reinstalled the dotnet 8 sdk from scratch.

Thank you for your time.

@bwulms bwulms closed this as completed Jun 2, 2024
@bwulms
Copy link
Author

bwulms commented Jun 2, 2024

Solved by removing dotnet completely by deleting /usr/local/share/dotnet and then installing only the arm version of the dotnet 8 sdk.

@geomorillo
Copy link

geomorillo commented Aug 3, 2024

im on windows 10 and have the same problem, reading here i realized i had more than 1 vscode versions installed

@jeffstienstra
Copy link

Solved by removing dotnet completely by deleting /usr/local/share/dotnet and then installing only the arm version of the dotnet 8 sdk.

This has been plaguing me for weeks! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-solution Solution explorer bug Something isn't working mac MacOS
Projects
None yet
Development

No branches or pull requests

4 participants