This issue has been moved from a ticket on Developer Community.
[severity:It bothers me. A fix would be nice]
Hi,
in the current version of VS 2026 18.1.0 there seems to be a little bug when trying to apply the “prefer IsEmpty over Count” refactoring on a ConcurrentDictionary. It seems that this is only an issue if the original code uses pattern matching syntax
if (test. Count is > 0) // ... but the refactoring works as expected for: if (test. Count > 0)
same for
if (test. Count is 0)
{
test. TryAdd("d", 2);
}
after refactoring its:
if (IsEmpty)
{
test. TryAdd("d", 2);
}
Please see the attached gif video.
Incorrect_IsEmpty_Refactorying.gif
Original Comments
Feedback Bot on 12/17/2025, 08:50 AM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.