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

FAR on Create method of a collection builder doesn't find all the usages #71133

Open
jcouv opened this issue Dec 6, 2023 · 1 comment
Open

Comments

@jcouv
Copy link
Member

jcouv commented Dec 6, 2023

Repro:

  1. create a project with the code below
  2. invoke FindAllReferences on the Create method
  3. the result only shows one reference (in the [CollectionBuilder(...)] attribute) but should also list the usage in C c = [true, false];
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;

[CollectionBuilder(typeof(Builder), nameof(Builder.Create))]
class C : IEnumerable<bool>
{
    void M()
    {
        C c = [true, false];
    }

    IEnumerator<bool> IEnumerable<bool>.GetEnumerator() => throw null!;
    IEnumerator IEnumerable.GetEnumerator() => throw null!;
}
internal class Builder
{
    public static C Create(ReadOnlySpan<bool> source)
    {
        return new C();
    }
}

image

Relates to test plan #66418

For context, here's how a similar issue was fixed previously (FAR on GetAwaiter methods involved in await): #28230

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Dec 6, 2023
@genlu genlu added Navigation-FAR Find all references and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Dec 15, 2023
@CyrusNajmabadi
Copy link
Member

Unlikely to support this. It's a niche case. We don't expect users to be typing these or doing FAR on these. They'll just get these handful of methods when they upgrade to a recent version of S.C.I.dll

@CyrusNajmabadi CyrusNajmabadi removed their assignment Dec 15, 2023
@CyrusNajmabadi CyrusNajmabadi added this to the Backlog milestone Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants