dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.98k stars 4.03k forks source link

New files, members are not recognized after git pull #75495

Open Peter-Juhasz opened 1 day ago

Peter-Juhasz commented 1 day ago

Version Used: 17.12 P2.1 with no extensions enabled

Steps to Reproduce:

  1. Somebody pushes changes
  2. Pull changes

New files and added/changed members are not recognized:

Image

The new files are not even visible in Solution Explorer, although they are there in the file system:

Image

The project is a standard class library:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="*" />
    <PackageReference Include="System.Linq.Async" Version="*" />
  </ItemGroup>

</Project>

(Content of one of the missing files:)

Image

(Code successfully compiles on the build server.)

Additional information

AccelerateBuildsInVisualStudio is enabled.

<Project>
    <PropertyGroup>
        <AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
        <EnableNETAnalyzers>true</EnableNETAnalyzers>
    </PropertyGroup>
</Project>

Workaround

This issue makes work quite difficult if more than 1 people work on a project.

CyrusNajmabadi commented 1 day ago

Populating solution explorer is not a Roslyn issue. This sounds like CPS or msbuild issue.

Peter-Juhasz commented 23 hours ago

Neither Visual Studio Solution Explorer (nor Code Search), (although files are available in the file system) nor Roslyn/IntelliSense picks up the changes after a git pull. I was not sure about the layering here, whether Roslyn access the file system directly or only via Visual Studio Project System, and since it is broken, the issue bubbles up.

CyrusNajmabadi commented 23 hours ago

We only know about the files the project system tells us about. It's for them ma msbuild to interpret the project file, and then determine if new files should now be included.

Peter-Juhasz commented 23 hours ago

I've found a matching issue here: https://developercommunity.visualstudio.com/t/Visual-Studio-shows-outdated-errors-when/10761617

Although it has already got the infamous "Needs more info" state, I added a comment there referencing this issue.