tareqimbasher / NetPad

A cross-platform C# editor and playground.
MIT License
1.09k stars 56 forks source link

Intellisense not working when .NET 7 not installed #208

Closed bux closed 1 week ago

bux commented 1 month ago

Using v0.7.1 on Windows 11

Omnisharp throwing an error (AppData\Local\NetPad\Logs)

2024-06-02T02:01:23.6246543+02:00 [INF] (PID: 16492|Microsoft.Hosting.Lifetime) Now listening on: http://localhost:57930
2024-06-02T02:01:23.7128517+02:00 [INF] (PID: 16492|Microsoft.Hosting.Lifetime) Application started. Press Ctrl+C to shut down.
2024-06-02T02:01:23.7130476+02:00 [INF] (PID: 16492|Microsoft.Hosting.Lifetime) Hosting environment: Production
2024-06-02T02:01:23.7130980+02:00 [INF] (PID: 16492|Microsoft.Hosting.Lifetime) Content root path: C:\Program Files\NetPad\resources\bin\
2024-06-02T02:01:30.8017534+02:00 [INF] (PID: 16492|OmniSharp.Stdio.Host) Starting OmniSharp on Windows 10.0.22631.0 (x64)
2024-06-02T02:01:30.9661779+02:00 [ERR] (PID: 16492|OmniSharp.Stdio.OmniSharpStdioServer) OmniSharpServer Error Output: Installed SDKs:
2024-06-02T02:01:30.9661804+02:00 [ERR] (PID: 16492|OmniSharp.Stdio.OmniSharpStdioServer) OmniSharpServer Error Output: A compatible .NET SDK was not found.
2024-06-02T02:01:30.9662555+02:00 [ERR] (PID: 16492|OmniSharp.Stdio.OmniSharpStdioServer) OmniSharpServer Error Output: global.json file: C:\Program Files\NetPad\resources\bin\global.json
2024-06-02T02:01:30.9661728+02:00 [ERR] (PID: 16492|OmniSharp.Stdio.OmniSharpStdioServer) OmniSharpServer Error Output: Learn about SDK resolution:
2024-06-02T02:01:30.9661856+02:00 [ERR] (PID: 16492|OmniSharp.Stdio.OmniSharpStdioServer) OmniSharpServer Error Output: https://aka.ms/dotnet/sdk-not-found
2024-06-02T02:01:30.9661790+02:00 [ERR] (PID: 16492|OmniSharp.Stdio.OmniSharpStdioServer) OmniSharpServer Error Output: Requested SDK version: 7.0.0
2024-06-02T02:01:30.9661780+02:00 [ERR] (PID: 16492|OmniSharp.Stdio.OmniSharpStdioServer) OmniSharpServer Error Output: Install the [7.0.0] .NET SDK or update [C:\Program Files\NetPad\resources\bin\global.json] to match an installed SDK.
2024-06-02T02:01:30.9667599+02:00 [ERR] (PID: 16492|OmniSharp.Stdio.OmniSharpStdioServer) OmniSharpServer Error Output: A compatible .NET SDK was not found.
2024-06-02T02:01:30.9667757+02:00 [ERR] (PID: 16492|OmniSharp.Stdio.OmniSharpStdioServer) OmniSharpServer Error Output: global.json file: C:\Program Files\NetPad\resources\bin\global.json
2024-06-02T02:01:30.9667773+02:00 [ERR] (PID: 16492|OmniSharp.Stdio.OmniSharpStdioServer) OmniSharpServer Error Output: Requested SDK version: 7.0.0
2024-06-02T02:01:30.9667762+02:00 [ERR] (PID: 16492|OmniSharp.Stdio.OmniSharpStdioServer) OmniSharpServer Error Output: Installed SDKs:
2024-06-02T02:01:30.9670101+02:00 [ERR] (PID: 16492|OmniSharp.Stdio.OmniSharpStdioServer) OmniSharpServer Error Output: Install the [7.0.0] .NET SDK or update [C:\Program Files\NetPad\resources\bin\global.json] to match an installed SDK.
2024-06-02T02:01:30.9670252+02:00 [ERR] (PID: 16492|OmniSharp.Stdio.OmniSharpStdioServer) OmniSharpServer Error Output: https://aka.ms/dotnet/sdk-not-found
2024-06-02T02:01:30.9670220+02:00 [ERR] (PID: 16492|OmniSharp.Stdio.OmniSharpStdioServer) OmniSharpServer Error Output: Learn about SDK resolution:
2024-06-02T02:01:31.0449387+02:00 [ERR] (PID: 16492|OmniSharp.Stdio.OmniSharpStdioServer) OmniSharpServer Error Output:    at Microsoft.Build.Locator.DotNetSdkLocationHelper.GetDotNetBasePaths(String workingDirectory)+MoveNext()
2024-06-02T02:01:31.0449484+02:00 [ERR] (PID: 16492|OmniSharp.Stdio.OmniSharpStdioServer) OmniSharpServer Error Output:    at Microsoft.Build.Locator.MSBuildLocator.GetInstances(VisualStudioInstanceQueryOptions options)+MoveNext()
2024-06-02T02:01:31.0449145+02:00 [ERR] (PID: 16492|OmniSharp.Stdio.OmniSharpStdioServer) OmniSharpServer Error Output: System.InvalidOperationException: Failed to find all versions of .NET Core MSBuild. Call to hostfxr_resolve_sdk2. There may be more details in stderr.

Though running dotnet --list-sdks I get:

❯ dotnet --list-sdks
6.0.321 [C:\Program Files\dotnet\sdk]
8.0.206 [C:\Program Files\dotnet\sdk]
8.0.301 [C:\Program Files\dotnet\sdk]
tareqimbasher commented 1 month ago

@bux this is a bug that will be fixed in the next release. Delete the file: C:\Program Files\NetPad\resources\bin\global.json and restart NetPad, it should work fine after that. That global.json should be omitted from the release package.

bux commented 1 month ago

Yeah, that solved the issue. Thanks. 😄

tareqimbasher commented 1 week ago

v0.7.2 is released with this bug fixed!

vchirikov commented 1 week ago

@tareqimbasher it will be nice to add a warning to release something like

[!WARNING]
if you install netpad manually don't forget to manually remove <install_path>/resources/bin/global.json

tareqimbasher commented 1 week ago

@vchirikov good idea, I will include bug workarounds in release notes in the future. This bug in particular however is now fixed in latest release. Thank you for the suggestion