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.71k stars 3.98k forks source link

Go To Definition on external package only works as expected the very first time #74220

Open vsfeedback opened 3 days ago

vsfeedback commented 3 days ago

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


[severity:It's more difficult to complete my work] In a C# project I have a PackageReference to Vanara.PInvoke.User32, and in the code a call to a method from it, something akin to the following.

Vanara.PInvoke.User32.SendMessage(new HWND(), uint.MaxValue, IntPtr.Zero, "");

Performing "Go To Definition" action on it in a .NET Framework project for the very first time for a specific version of the package (f.e. 4.0.1) brings me to the definition of the method in the User32 class, as expected. Any subsequent time, from different projects, as long as it's .NET Framework and the same package version, gets me to TvOut.cs [embedded] where public static partial class User32 is defined. Trying to go to the method I want via the navigation bar results in a The definition of the object is hidden. error message.

This is exceptionally frustrating.

Interestingly, this works just fine for .NET8 projects every time.


Original Comments

Feedback Bot on 5/22/2024, 08:31 PM:

(private comment, text removed)

Wenwen Fan [MSFT] on 5/22/2024, 10:17 PM:

(private comment, text removed)

Timur Kelman on 5/23/2024, 04:34 AM:

(private comment, text removed)

Wenwen Fan [MSFT] on 6/3/2024, 05:01 AM:

(private comment, text removed)

Wenwen Fan [MSFT] on 5/30/2024, 01:29 AM:

(private comment, text removed)

Timur Kelman on 6/3/2024, 02:27 AM:

(private comment, text removed)

Wenwen Fan [MSFT] on 6/3/2024, 04:24 AM:

(private comment, text removed)

Timur Kelman on 6/3/2024, 04:35 AM:

(private comment, text removed)

Timur Kelman on 6/3/2024, 05:03 AM:

(private comment, text removed)

Wenwen Fan [MSFT] on 6/27/2024, 01:23 AM:

(private comment, text removed)

Wenwen Fan [MSFT] on 6/27/2024, 01:24 AM:

(private comment, text removed)

Timur Kelman on 6/27/2024, 02:35 AM:

(private comment, text removed)

Feedback Bot on 6/27/2024, 03:22 AM:

(private comment, text removed)


Original Solutions

(no solutions)

TymurGubayev commented 3 days ago

workaround: uncheck Tools>Options>Text Editor>C#>Advanced>Enable navigation to Source Link and Embedded sources, leave Enable navigation to decompiled sources checked.