Fix Union to match the semantics of GetApplicableAnalyzers#64484
Fix Union to match the semantics of GetApplicableAnalyzers#64484davidwengier merged 4 commits intodotnet:release/dev17.4from
Conversation
| } | ||
|
|
||
| [Fact] | ||
| public async Task SpecificAnalyzers_SpecificThenAll() |
There was a problem hiding this comment.
This test fails without the changeso the Union method
| asyncToken); | ||
| } | ||
|
|
||
| public WorkItem With(ImmutableHashSet<IIncrementalAnalyzer> specificAnalyzers, IAsyncToken asyncToken) |
There was a problem hiding this comment.
This method was unused, and didn't call Union at all, so I thought it best to remove before someone calls it and does who-knows-what
|
Sadly, this assert is failing, Not sure if thats a problem though, or just validating an old assumption. @mavasani any context you could help with? I've validated on my machine that |
src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.WorkItem.cs
Outdated
Show resolved
Hide resolved
So, the assert seems to be still valid, and the subsequent code in this method is actually relying on it. If you look at the below line: For your case, this will be empty set of analyzers, so the entire method var reanalyzers = workItem.GetApplicableAnalyzers(analyzers).ToImmutableArray(); This would require you to thread in the |
|
Looks like the first thing that |
| } | ||
|
|
||
| // First reset the document state in analyzers. | ||
| var reanalyzers = workItem.SpecificAnalyzers.ToImmutableArray(); |
There was a problem hiding this comment.
Just from looking at the code, and having no other context, I'm wondering if perhaps this method was intended to run only when there are specific analyzers on a work item.. in which case perhaps rather than removing the assert, it would make more sense to simply add || workItem.SpecificAnalyzers.Count > 0 to the early-return guard above?
But at the same time, what I have here also makes sense. All of the tests pass too, so I really don't know what exactly to go on, to try to work out what this method is intended to do.
There was a problem hiding this comment.
Yeah, the core issue seems to be "Reanalyze" was designed only for a single/subset of specific analyzers. I think your change is fine to unblock us, and lets pray that @CyrusNajmabadi kills the solution crawler before this change uncovers more bugs :-)
There was a problem hiding this comment.
So I shouldn't point out the bit of code I found, where if you call item.With(..., ..., item.AsyncToken) the first thing the With method does is dispose the async token that you're trying to re-use? :D
There was a problem hiding this comment.
Doesn't it dispose the old one and re-use the new one?
roslyn/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.WorkItem.cs
Lines 133 to 143 in d04c23b
There was a problem hiding this comment.
Right, bit there are spots where the old one is passed in, to be the new one, presumably assuming it will just be reused.
There was a problem hiding this comment.
Probably add a guard that AsyncToken != asyncToken around the above Dispose call?
There was a problem hiding this comment.
I don't know if I want to touch it.. this is going into 17.4 under QB and I don't understand the implications
|
Bug for QB: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1639039 @arkalyanms for approval |
No description provided.