question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.net-core project constantly needs to restore if build/test happening in WSL/bash

See original GitHub issue

Environment data

WSL\bash $dotnet --info

.NET Command Line Tools (2.0.3)
Product Information:
 Version:            2.0.3

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  16.04
 OS Platform: Linux
 RID:         ubuntu.16.04-x64
 Base Path:   /usr/share/dotnet/sdk/2.0.3/

Microsoft .NET Core Shared Framework Host
Version  : 2.0.3

Windows\cmd.exe dotnet --info

.NET Command Line Tools (2.1.4)
Product Information:
 Version:            2.1.4

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16299
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.4\

Microsoft .NET Core Shared Framework Host
  Version  : 2.0.5

VS Code version:1.20.0 C# Extension version: 1.14.0

Steps to reproduce

  • In VS Code open a NET CORE 2.0 C# app folder containing an SLN file, and two subfolders, each containing one CSPROJ file.
  • C# Extension works, intellisense and navigating between symbols works
  • In VS Code internal terminal (wsl\bash), or in an external terminal (wsl\bash) do a dotnet build
  • Almost immediately 100% of the source code turns red with squigglies, intellisense goes kapput. And shortly thereafter two info boxes popup in VS Code each saying “There are unresolved dependencies from src\Project.csproj. Please execute the restore command to continue.”, one for each CSPROJ.
  • Clicking the Restore button makes the C# extension work again after ~15-20 seconds.
  • Interestingly, “dotnet restore” in the shell (whether internal terminal or external terminal) does not help the C# extension. By the way, restore shouldn’t even be needed since this bug repros even if you have not added any new dependencies on nuget packages since the last build, nor edited the CSPROJ, nor edited the SLN. Actually even if you don’t edit anything, and rebuild with “dotnet build” that build basically does nothing, but C# extension still goes kaput until you click the info boxes “Restore” buttons and wait.

This bug does not seem to repro if I dotnet build or dotnet test in cmd.exe, it only repros if I do in WSL/bash (internal or external terminal)

For that reason this bug could actually be in .NET CORE SDK for Linux, or perhaps in Windows Subsystem For Linux. I don’t really know enough about what’s causing this to decide whether to open this issue with those teams instead.

Expected behavior

The C# extension doesn’t go kaput while a background task is building the project. I build very frequently, including using CTRL-SHIFT-B a key binding to a VSCode task set to “dotnet build”, and each time the project goes dead until the build is over + 15-20 seconds to restore. Why?

Actual behavior

The C# extension goes kaput each time you dotnet build.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:17
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
micahjcommented, Aug 8, 2018

Hey @mipnw did you ever get any resolution to this? Cheers

1reaction
dkdewittcommented, Feb 8, 2019

Was this ever resolved? Can’t use WSL and VSCode currently as ther conflicts between WSL and WIndows are causing all .NET objects to not be found.

Read more comments on GitHub >

github_iconTop Results From Across the Web

visual studio code - VSCode constantly asks me to Restore
When I click the "Restore" button inside the info box, about 15 seconds later the project works again. But why, this happens all...
Read more >
Running .NET Core Apps under Windows Subsystem for ...
WSL is a built in feature of Windows 10 (Anniversary Update and later) that's always available by simply typing Bash into the Start...
Read more >
Troubleshooting Windows Subsystem for Linux | Microsoft Learn
In this article. File an issue, bug report, feature request; Installation issues; Common issues; Using older versions of Windows and WSL ...
Read more >
Work in Windows Subsystem for Linux with Visual Studio Code
You'll start a new instance of the bash shell in WSL, again from VS Code running on Windows. Tip: In the lower left...
Read more >
WSL2 for Dockerized .NET Core application - Subhankar Sarkar
NET Core Application using Docker on Windows Subsystem for Linux (WSL) 2 ... If you are Windows Insider then you have to download...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found