You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Getting nothing from GetAllUsesOfAllSymbols() when using DocumentSource.Custom #15960
It seems to be a caching issue, as the usage of DocumentSource.Custom means that useChangeNotifications will be set to true in the builder which affects the slots.
A workaround is calling FSharpChecker.NotifyFileChanged for the files in the project before calling ParseAndCheckProject().
Is this really the expected behaviour when using DocumentSource.Custom or something we should document?
Hey, so this happens when you check the project for the first time? In general you do need to call NotifyFileChanged when a file has changed when using DocumentSource.Custom, which is documented. But it's suspicious if you get empty symbol uses. Maybe there's a bug with IncrementalBuilder state initialization or something. I'll have a look.
Hey, so this happens when you check the project for the first time?
Well, calling ParseAndCheckProject multiple times before the first call to GetAllUsesOfAllSymbols makes no difference in this case. The result of GetAllUsesOfAllSymbols is still empty.
After some experimentation, setting Notified = truein the initial state seems to fix it. But I can't yet tell why exactly and if it can have some negative consequences.
@majocha Do you remember anything about this by any chance?
The Activity traces look the same regardless of initially setting Notified to true or false. Except in the first case symbols are present and in the second one they aren't.
Yeah it's a bit strange because everything else seems to work fine. I thought maybe this was somehow causing the bound models to be invalidated so we can't access tcExtras even though it must have been produced by the full project check. Anyway, let's make the change and see what happens :)
Activity
0101 commentedon Sep 11, 2023
Hey, so this happens when you check the project for the first time? In general you do need to call
NotifyFileChangedwhen a file has changed when usingDocumentSource.Custom, which is documented. But it's suspicious if you get empty symbol uses. Maybe there's a bug with IncrementalBuilder state initialization or something. I'll have a look.dawedawe commentedon Sep 11, 2023
Well, calling
ParseAndCheckProjectmultiple times before the first call toGetAllUsesOfAllSymbolsmakes no difference in this case. The result ofGetAllUsesOfAllSymbolsis still empty.0101 commentedon Sep 12, 2023
After some experimentation, setting
Notified = truein the initial state seems to fix it. But I can't yet tell why exactly and if it can have some negative consequences.@majocha Do you remember anything about this by any chance?
majocha commentedon Sep 12, 2023
Probably this will force checking of every file from the start. I'll try to look and refresh my memory later today.
0101 commentedon Sep 12, 2023
Here's a test for it: #15966
The Activity traces look the same regardless of initially setting
Notifiedtotrueorfalse. Except in the first case symbols are present and in the second one they aren't.majocha commentedon Sep 12, 2023
@0101 sounds like a good fix :)
For
useChangeNotifications=falsethe indication that the a slot has never been checked is kinda hidden here:fsharp/src/Compiler/Service/IncrementalBuild.fs
Line 1070 in 1f37bd6
Notified = trueshould give the same behavior whenuseChangeNotifications=true. I wonder how and why this worked at all before 😅.0101 commentedon Sep 13, 2023
Yeah it's a bit strange because everything else seems to work fine. I thought maybe this was somehow causing the bound models to be invalidated so we can't access tcExtras even though it must have been produced by the full project check. Anyway, let's make the change and see what happens :)
dawedawe commentedon Sep 18, 2023
Thanks guys ❤️