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] Mac OSX Extension complete functionality failure #337

Closed
AzuStar opened this issue Aug 6, 2023 · 15 comments
Closed

[BUG] Mac OSX Extension complete functionality failure #337

AzuStar opened this issue Aug 6, 2023 · 15 comments
Assignees
Labels
area-project-cps bug Something isn't working mac MacOS needs-more-info Needing more information, waiting on OP triaged The issue has been triaged
Milestone

Comments

@AzuStar
Copy link

AzuStar commented Aug 6, 2023

Describe the Issue

Do not deprecate Unity Debugger yet. C# DevKit is not ready. My work is now on a complete halt because I cant debug.

Problem 1 Logs.
Host

2023-08-06 07:23:47.574 [info] ExtensionService#_doActivateExtension ms-dotnettools.vscode-dotnet-runtime, startup: false, activationEvent: 'onLanguage:csharp', root cause: ms-dotnettools.csharp
2023-08-06 07:23:48.040 [info] ExtensionService#_doActivateExtension ms-dotnettools.csharp, startup: false, activationEvent: 'onLanguage:csharp'
2023-08-06 07:24:23.902 [info] ExtensionService#_doActivateExtension mark-wiemer.vscode-autohotkey-plus-plus, startup: false, activationEvent: 'onDebug'
2023-08-06 07:24:25.157 [info] ExtensionService#_doActivateExtension vscode.debug-server-ready, startup: false, activationEvent: 'onDebugResolve'

C#

Dotnet path: /usr/local/share/dotnet/dotnet
Activating C# standalone...
info: LanguageServerHost[0]
      Starting server...

Problem 2 Logs.
Host

2023-08-06 07:35:51.429 [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication, startup: false, activationEvent: 'onAuthenticationRequest:microsoft'
2023-08-06 07:35:51.455 [info] ExtensionService#_doActivateExtension ms-dotnettools.vscode-dotnet-runtime, startup: true, activationEvent: 'workspaceContains:**/*.{csproj,sln,slnf,csx,cake}', root cause: ms-dotnettools.csharp
2023-08-06 07:35:52.001 [info] ExtensionService#_doActivateExtension ms-dotnettools.csharp, startup: true, activationEvent: 'workspaceContains:**/*.{csproj,sln,slnf,csx,cake}'
2023-08-06 07:35:52.370 [info] ExtensionService#_doActivateExtension ms-dotnettools.csdevkit, startup: true, activationEvent: 'workspaceContains:**/*.csproj'
2023-08-06 07:35:52.493 [info] Eager extensions activated
2023-08-06 07:35:52.568 [info] ExtensionService#_doActivateExtension ms-dotnettools.vscodeintellicode-csharp, startup: false, activationEvent: 'api', root cause: ms-dotnettools.csharp
2023-08-06 07:35:52.657 [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: false, activationEvent: 'onStartupFinished'
2023-08-06 07:35:52.660 [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
2023-08-06 07:35:52.679 [info] ExtensionService#_doActivateExtension ban.spellright, startup: false, activationEvent: 'onStartupFinished'
2023-08-06 07:35:52.681 [info] ExtensionService#_doActivateExtension dbaeumer.vscode-eslint, startup: false, activationEvent: 'onStartupFinished'
2023-08-06 07:35:52.701 [info] ExtensionService#_doActivateExtension Equinusocio.vsc-material-theme, startup: false, activationEvent: 'onStartupFinished'
2023-08-06 07:35:52.713 [info] ExtensionService#_doActivateExtension equinusocio.vsc-material-theme-icons, startup: false, activationEvent: 'onStartupFinished'
2023-08-06 07:35:52.792 [info] ExtensionService#_doActivateExtension GitHub.copilot-chat, startup: false, activationEvent: 'onStartupFinished'
2023-08-06 07:35:52.918 [info] ExtensionService#_doActivateExtension GitHub.copilot-labs, startup: false, activationEvent: 'onStartupFinished'
2023-08-06 07:35:53.070 [info] ExtensionService#_doActivateExtension usernamehw.errorlens, startup: false, activationEvent: 'onStartupFinished'

C# DevKit Test

Created Test Controller
Using vstest from dotnet sdk in [/usr/local/share/dotnet/sdk/7.0.306].
Initialized Test Explorer Server [19933]
Test Store Folder: /Users/Azureus/Library/Application Support/Code/User/workspaceStorage/249aea4311b2e6be05f23536b3fa9f5c/ms-dotnettools.csdevkit
Test data store opened in 0.010 sec.
Initialized project system provider.

C# DevKit

Starting Spawn .NET server...
Starting Open a solution...
Starting Open a solution with environment service...
Starting Clear environment...
.NET server started and IPC established in 2989ms
Completed Spawn .NET server (3005ms)
Completed Clear environment (3727ms)
Completed Open a solution with environment service (3954ms)
Starting Restore solution...
Completed Open a solution (3981ms)
Completed Restore solution (2385ms)

C#

Dotnet path: /usr/local/share/dotnet/dotnet
Activating C# + C# Dev Kit + C# IntelliCode...
info: LanguageServerHost[0]
      Starting server...

Projects

2023-08-06 07:35:58.882 [info] Project system initialization finished. 0 project(s) are loaded, and 1 failed to load.

Thank you for your hard work! For now, have to rollback to old C#, otherwise excited to start using C# DevKit with Unity!

Steps To Reproduce

Problem 1: Can't start basic console app

  1. Terminal sudo rm -r /usr/local/share/dotnet/
  2. Uninstall all C# vscode extensions (C#, C# devkit, Unity, C# Intellisence etc).
  3. Restart VSCode
  4. Install net7.0 sdk from dotnet.microsoft.com
  5. Terminal dotnet new console -o ./TestNet
  6. Terminal code TestNet
  7. Open Program.cs
  8. Install recommended extensions.
  9. Go to debug, press Generate C# Build Assets.
    Error: Could not locate .NET Core project in TestNet. Assets were not generated.

Problem 2: Project failed to load (cannot get intellisense prompt, cannot navigate, cannot launch, cannot debug)
Problem 1 upto step 8.
9. Follow C# Devkit quickstart guide except last step.

Install C# Dev Kit (The C# extension, the IntelliCode for C# Dev Kit, and the .NET Runtime Install Tool will automatically be installed)
Open a folder/workspace that contains a C# project (.csproj) and the extension will activate.
  1. Restart VSCode.
  2. Open .NET folder/workspace.
    Error: project failed to load. No error message.

Expected Behavior

No response

Environment Information

OS: OSX Catalina 10.15.7 (Intel x64)
VSCode about: ```
Version: 1.81.0
Commit: 6445d93c81ebe42c4cbd7a60712e0b17d9463e97
Date: 2023-08-02T12:40:02.782Z (3 days ago)
Electron: 22.3.18
ElectronBuildId: 22689846
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Darwin x64 19.6.0


Extensions:
.NET Install Tool for Extension Authors
v1.6.0
C#
v2.0.328
C# Dev Kit
v0.3.21
IntelliCode for C# Dev Kit
v0.1.26
NuGet Gallery
v0.0.24
@AzuStar AzuStar added the bug Something isn't working label Aug 6, 2023
@nslinco
Copy link

nslinco commented Aug 7, 2023

Any updates? My environment info is all identical and I'm getting the same problem & outputs. My Unity project was working just fine in Visual Studio Code last night, now C# appears to be entirely broken. Switching the Unity Preferences - External Script Editor to Visual Studio for Mac works, but simply not using VS Code isn't much of a solution if that's your preferred editor.

@jbevain
Copy link
Member

jbevain commented Aug 7, 2023

Two things:

  • Try updating the C# Dev Kit extension to the latest Preview: v0.4.2.
  • The fact that it's telling you that 1 project failed to load makes me think there's a configuration issue.

In Unity's Package Manager (Windows -> Package Manager), make sure the Visual Studio Editor is updated to the version 2.0.20. This is the version of the package that knows how to work with Visual Studio Code (the old Visual Studio Code Editor package is published by Unity and they stopped supporting it).

In Unity's Preferences -> External Tools, make sure Visual Studio Code is selected as the External Editor, and do “Regenerate project files”. This will generate csproj files that the C# Dev Kit understands.

@JonathanTremblay
Copy link

I'm facing the same issue. I'm also running MacOS 10.15.7 Intel.
I tried all suggestions provided, but unfortunately, none of them resolved the issue. Here's what I've attempted:

  • Updated the C# Dev Kit extension to its latest Preview version v0.4.2.
  • Confirmed that the Visual Studio Editor package is at version 2.0.20.
  • Removed the outdated Visual Studio Code Editor package.
  • Double-checked that my Unity Preferences have Visual Studio Code (1.81.0) selected.
  • Regenerated project files.

Naturally, I've already restarted my computer. Additionally, I manually deleted the .sln and .csproj files, hoping for a fresh start.

Any other ideas @jbevain?

By the way, it works well on my PC.

@AzuStar
Copy link
Author

AzuStar commented Aug 7, 2023

The problem affects unity but is fundamentally faulty.
When it comes to unity specifically, the new package 2.0.20 was working from the beginning as well as the new Unity extension in vscode, however, the unloaded projects in the solutions means that all unity and normal (even simple console apps) solutions fail to load and initialise C# language services (factoring, code navigation, type resolution, intellisense etc) do not function.
I mentioned Unity in the issue because Unity projects are affected.

@drew-512
Copy link

drew-512 commented Aug 9, 2023

all unity and normal (even simple console apps) solutions fail to load and initialise C# language services (factoring, code navigation, type resolution, intellisense etc) do not function.

Same here -- similar setup and versions as @JonathanTremblay:

  • macOS 10.14.6 (Intel)
  • C# 2.0.328
  • C# Dev Kit v0.4.2
  • VS Code 1.81.0
  • Visual Studio Editor Unity pkg 2.0.20 (and removed pkg Visual Studio Code Editor)

P5VJ3

Thanks MS team for looking at this -- we know you're working hard and get how important support is on VSC for macOS and Unity. Keep up the great work.

@drew-512
Copy link

drew-512 commented Aug 9, 2023

Do not deprecate Unity Debugger yet. C# DevKit is not ready. My work is now on a complete halt because I cant debug.

Agree. I had to manually side load the prev version to get working again since VSC doesn't let you otherwise install a deprecated extension.

@montoulieu
Copy link

I'm experiencing the same issues on one of my Macs that was was running Unity projects perfectly before.

For me in the C# Dev Kit - Test Explorer I get a strange error that makes it seem like its trying to load some .dll:

Created Test Controller
Using vstest from dotnet sdk in [/usr/local/share/dotnet/sdk/7.0.306].
System.Exception: An error occurred when opening the file /usr/local/bin/dotnet with arguments "/usr/local/share/dotnet/sdk/7.0.306/vstest.console.dll" /parentprocessid:58097 /port:53061.
 ---> System.ComponentModel.Win32Exception (2): An error occurred trying to start process '/usr/local/bin/dotnet' with working directory '/Users/montoulieu/Code/Unity/Sports'. No such file or directory
   at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at Microsoft.TestPlatform.VsTestConsole.TranslationLayer.VsTestConsoleProcessManager.StartProcess(ConsoleParameters consoleParameters)
   --- End of inner exception stack trace ---
   at Microsoft.TestPlatform.VsTestConsole.TranslationLayer.VsTestConsoleProcessManager.StartProcess(ConsoleParameters consoleParameters)
   at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProviders.LocalTestPlatformProvider.ActivateSessionAsync(ITestWindowCallbackService testWindowCallbackService, ITestAgentBridgeCallback TestAgentBridgeCallback, Boolean enableDiagnosticLogging, RuntimeEnvironment runtimeEnvironment, IDictionary`2 environment, IDictionary`2 props, InitializeCapabilitiesRequest clientCapabilities, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.TestWindow.Host.TestPlatformAgentPool.<>c__DisplayClass24_0.<<CreateRemoteAgentAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.VisualStudio.TestWindow.Utilities.EventPumpExtensions.<>c__DisplayClass4_0`1.<<EnqueueAsync>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.VisualStudio.TestWindow.Extensibility.TaskCompletionSourceExtensions.RunTaskWithCatchAsync[T](TaskCompletionSource`1 taskCompletionSource, Func`1 task)
   at Microsoft.VisualStudio.TestWindow.Logging.ILoggerExtensions.CallWithCatchAsync(IInternalLogger log, Func`1 func)
   at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProvider.GetProviderAsync(ITestWindowCallbackService callbackClient, IInternalLogger logger, ITestWindowHostTelemetry telemetryService, ICollection`1 runtimeEnvironments, IDictionary`2 environmentVariables, Boolean enableDiagnosticLogging, Boolean autoInstallRuntimePrereqs, InitializeCapabilitiesRequest clientCapabilities, ITestPlatformProviderMap testPlatformProviderMap)
   at Microsoft.VisualStudio.TestWindow.Host.TestWindowStoreService.InitializeVSCodeServiceAsync(InitializeOptions initializeRequest, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.TestWindow.VSCode.Service.TestWindowVSCodeService.InitializeAsync(InitializeOptions options, CancellationToken cancellationToken)
unable to create test controller for c# extension: Error: An error occurred when opening the file /usr/local/bin/dotnet with arguments "/usr/local/share/dotnet/sdk/7.0.306/vstest.console.dll" /parentprocessid:58097 /port:53061.

I have another Mac that is having no problems with the same configuration and my Windows machines can load the same project as well.

Please help with a fix for this as its ruined my productivity with Unity on this device.

@eastedgeZack
Copy link

Same issue on Mac Big Sur

@webreidi webreidi added this to the GA milestone Aug 16, 2023
@webreidi webreidi added the mac MacOS label Aug 16, 2023
@Michael-Eng
Copy link
Member

Michael-Eng commented Aug 18, 2023

Two questions to narrow this down:

  1. Please confirm this issue still reproduces with the latest pre-release version of C# Dev Kit (version 0.4.5)
  2. Are you on x64 or M1/M2 (ARM)? Which version of the .NET SDK do you have installed? If you're running on ARM do you have the ARM64 version of the .NET SDK installed? ([BUG] Solution explorer says "A compatible .Net SDK was not found" #194 )
  3. Do you have any copy of .NET SDK installed through homebrew? ([BUG] "A compatible .NET SDK was not found" when opening workspace #120 )

@Michael-Eng Michael-Eng self-assigned this Aug 18, 2023
@Michael-Eng Michael-Eng added needs-more-info Needing more information, waiting on OP triaged The issue has been triaged labels Aug 18, 2023
@drew-512
Copy link

  1. Please confirm this issue still reproduces with the latest pre-release version of C# Dev Kit (version 0.4.5)
  • C# 0.4.5 (Prerelease)
  • C# v2.0.376
  • Unity v0.9.0 (Preview)
  • VSC 1.81.1
  • Nothing installed from Homebrew

C# output:

Failed to find dotnet info from path, falling back to acquire runtime via ms-dotnettools.vscode-dotnet-runtime
Found dotnet version 7.0.10. Minimum required version is 7.0.100.
Dotnet path: /Users/aomeara/Library/Application Support/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/7.0.10/dotnet
Activating C# + C# Dev Kit + C# IntelliCode...
[Info  - 5:53:45 PM] [Program]Language server initialized

(C# Dev Kit shows no output)

$ which dotnet
/usr/local/share/dotnet/dotnet
$ dotnet --info
.NET SDK:
 Version:   7.0.400
 Commit:    73bf45718d

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.14
 OS Platform: Darwin
 RID:         osx.10.14-x64
 Base Path:   /usr/local/share/dotnet/sdk/7.0.400/

Host:
  Version:      7.0.10
  Architecture: x64
  Commit:       a6dbb800a4

.NET SDKs installed:
  7.0.110 [/usr/local/share/dotnet/sdk]
  7.0.202 [/usr/local/share/dotnet/sdk]
  7.0.305 [/usr/local/share/dotnet/sdk]
  7.0.400 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.10 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.30 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/usr/local/share/dotnet/sdk/]

global.json file:
  Not found

Apologies if this is ignorant, but I'm not even sure where/how to install runtime 7.0.100

Appreciate you on the case Michael!

@AzuStar
Copy link
Author

AzuStar commented Aug 19, 2023

Two questions to narrow this down:

  1. Please confirm this issue still reproduces with the latest pre-release version of C# Dev Kit (version 0.4.5)
  2. Are you on x64 or M1/M2 (ARM)? Which version of the .NET SDK do you have installed? If you're running on ARM do you have the ARM64 version of the .NET SDK installed? ([BUG] Solution explorer says "A compatible .Net SDK was not found" #194 )
  3. Do you have any copy of .NET SDK installed through homebrew? ([BUG] "A compatible .NET SDK was not found" when opening workspace #120 )

I have updated to the latest MacOS version, that seemed to have solved the issue. I cannot help any more since the problem is effectively gone. This is not a solution however, because I had to use OpenCore Patcher to update through restriction since my Mac is no longer supported. Others may experience the same problem.
Either way for me the issue is gone, so I will be closing the issue since I can no longer be of any help.

@AzuStar AzuStar closed this as completed Aug 19, 2023
@drew-512
Copy link

@AzuStar I get that your issue is addressed but there are many others here with this still open.

@Michael-Eng What path is best here to keep this issue being tracked for other setups?

@drew-512
Copy link

Apologies if this is ignorant, but I'm not even sure where/how to install runtime 7.0.100

I've looked and I cannot find any .NET runtime is that is larger than 7.0.10, or even marked 7.0.100 or above (other than 8). Can someone kindly divine the .NET versioning schema or bring some clarity to this for it make sense?

@JonathanTremblay
Copy link

⁠Thanks to the update of the C# extension (version 2.1.2) and the update of the C# Dev Kit extension (Pre-Release version 0.5.24) the problem is now solved on my Mac. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-project-cps bug Something isn't working mac MacOS needs-more-info Needing more information, waiting on OP triaged The issue has been triaged
Projects
None yet
Development

No branches or pull requests

10 participants