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.89k stars 4.01k forks source link

See squigglies in #if'd code but Quick Actions don't work. #74438

Open vsfeedback opened 1 month ago

vsfeedback commented 1 month ago

This issue has been moved from a ticket on Developer Community.


if NET5_0_OR_GREATER

namespace Foo;

public record File(FileStream f);

else

using System.IO;

namespace Foo;

public record File(FileStream f);

endif

I have the top left TFM selection dialog set to "net472", so that the net80 top part of the file is greyed out.

I see squigglies under FileStream, because the using statement is missing. Good. I see there are Quick Actions available. Good. image.png

I ctrl-. to open the dropdown of actions. Nothing happens; no dropdown. If I change the TFM selection to "net80", ctrl-. works. (Same behaviour using the icon.)

Desired outcome: either I don't see squigglies and so no quick actions, or I see squigglies and I can see and execute the quick actions.


Original Comments

Feedback Bot on 7/16/2024, 00:09 AM:

(private comment, text removed)


Original Solutions

(no solutions)

CyrusNajmabadi commented 1 month ago

Errors that are shown are the combined info about the file, analyzing it for each TFM. Lightbulbs, however, are for the current TFM.