Closed svick closed 19 minutes ago
cc: @ToddGrun, @jasonmalinowski
Seems like a duplicate of https://github.com/dotnet/roslyn/issues/74395, which has already been fixed
@DoctorKrolic I believe that issue is about additional files that are open and edited inside VS. This issue is about additional files that are modified by something else.
Also, the test above fails on current main.
@ToddGrun This might also be related to what you're looking at.
@ToddGrun fixed this in #75815.
Version Used: VS 17.10.5, Roslyn main (d939cd62029b)
We have noticed that in Visual Studio our incremental source generator is not regenerating its output when an additional file (that's watched by the incremental generator) is modified by an external action (i.e. the file is changed while not being opened in VS).
I was able to trace this to
Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.FileChangeWatcher
and specifically to the changes from https://github.com/dotnet/roslyn/pull/70936. Since that PR, it seemsFileChangeWatcher
is not reporting external changes to the correct project (files from multiple projects form a batch, and changes to these files are then all reported to the same sink, which corresponds to the first project in the batch), which is the cause of our source generator issue.This can be seen by the following test (place it inside the Microsoft.VisualStudio..LanguageServices.UnitTests project):
Expected: handler1Called=False, handler2Called=True
Actual: handler1Called=True, handler2Called=False