Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename and FindAllReferences broken across projects in Visual Studio 2019 based on Azure Functions projects #344

Closed
petehauge opened this issue Nov 8, 2019 · 6 comments

Comments

@petehauge
Copy link

Visual Studio Version: Visual Studio 2019 (16.3.6)

Summary: We are working with an Azure Functions project with associated unit tests and we’ve found that find all references, rename, etc, for the existing solution (VS 2019) doesn't work across all the projects. We followed all the troubleshooting online (ensure project-to-project references, clearing the intellisense cache, etc), but can’t get these features working across project.

NOTE: I originally opened this issue: dotnet/project-system#5624 , but after a discussion the result was "Wouldn’t it be less impactful to copy the required files into a separate “runtime” subfolder with the desired structure for the runtime than to alter the default placement of these files causing bugs like dotnet/project-system#5624? A simpler set of targets to copy things after the main build may be more reliable."

Steps to Reproduce:

  1. Create a new Azure Functions v2 project (http trigger)
  2. Create a new unit test project (.net core)
  3. Add a project reference from the unit test project to the functions project
  4. Add a method to the function project like this:
    public static bool Test()
    {
    return true;
    }
  5. Call the method above from the unit test project
  6. Right click on “Test” and choose Find All References

Expected Behavior: Should find the reference in the unit test project for the method

Actual Behavior: No references found

User Impact: Users can't use the code navigation & smart intellisense features. We've introduced bugs in the code when doing a 'rename' because we trusted Visual Studio to do the right thing.

findallreferences

@brettsam
Copy link
Member

We had discussion internally and ultimately we need to leave the build as-is on-disk instead of moving assemblies around like we do today. This should be do-able but in order to support F5 we need to copy (rather than move) the /bin folder into the correct structure that the Functions host expects. This likely means having some subfolder that represents the host rather than running it directly out of /bin.

@soninaren -- this will likely involve changes to the VS tools as they will need to use a different root directory on F5.

@rolandoldengarm
Copy link

@brettsam this is impacting me as well, is there a workaround? Or is there an ETA on a fix? Thanks!

@bm-evn
Copy link

bm-evn commented Apr 29, 2020

I know it's not a very good workaround, but I have refactored our Azure Functions project to use a .NET Standard library project for everything but the function binding methods. This allows unit test projects to again go directly to the source (now in the standard lib project) with Go To Definition. It's unfortunate that this bug results in an architectural change to our projects but it does get us working again.

kzu added a commit to devlooped/nosayudamos.org that referenced this issue May 5, 2020
Due to a bug in the Azure Functions SDK, Go To Definition and even
most intellisense is completely broken, making the entire experience
terrible. So we just implement the workaround mentioned in the bug
at Azure/azure-functions-vs-build-sdk#344
to place all code in a library instead.

The Api project now only contains the azure functions and nothing
more. It calls into the DI-injected dependencies as necessary, in
particular, it now consumes the IEventHandler<T> instead of implementing
those itself.
kzu added a commit to devlooped/nosayudamos.org that referenced this issue May 5, 2020
Due to a bug in the Azure Functions SDK, Go To Definition and even
most intellisense is completely broken, making the entire experience
terrible. So we just implement the workaround mentioned in the bug
at Azure/azure-functions-vs-build-sdk#344
to place all code in a library instead.

The Api project now only contains the azure functions and nothing
more. It calls into the DI-injected dependencies as necessary, in
particular, it now consumes the IEventHandler<T> instead of implementing
those itself.
@Camios
Copy link

Camios commented Jun 1, 2020

It is quite frustrating to have long-standing and expected Visual Studio behaviour such as intellisense and finding references broken.
Intellisense workaround is to manually build. But I don't have a workaround for VS going to metadata instead of the real source.
@brettsam what can we do to convince the team to prioritise a fix for this issue?

Affects Functions v3 too

@vijayrkn
Copy link
Collaborator

vijayrkn commented Jun 5, 2020

It is quite frustrating to have long-standing and expected Visual Studio behaviour such as intellisense and finding references broken.
Intellisense workaround is to manually build. But I don't have a workaround for VS going to metadata instead of the real source.
@brettsam what can we do to convince the team to prioritise a fix for this issue?

Affects Functions v3 too

We are working on a fix. Please find the attached PR. Hopefully we can get the fix deployed soon. Thanks for understanding.

@vijayrkn
Copy link
Collaborator

vijayrkn commented Jul 3, 2020

Rename and FindAllReferences should work with 3.0.8 version of v3 package - https://www.nuget.org/packages/Microsoft.NET.Sdk.Functions/3.0.8

Can you try upgrading to this version and see if it fixes all these issues?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants