Skip to content

[WIP] GenAPI: a work around for a generation an explicit interface implementation indexer. #31628

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

Closed

Conversation

andriipatsula
Copy link
Member

This is a work around solution for the #31570 issue to unblock the A&D team.

Indexer properties is not resolved correctly for the scenario like:

public interface IFooList<T>
{
    T this[int index] { get; set; }
}

public struct Bar<T> : IFooList<T>
{
    // indexer №1
    public T this[int index] { get; set; }

    // indexer №2
    T IFooList<T>.this[int index] { get; set; }
}

Indexer №1 is generated correctly, but explicit interface implementation indexer (№2) is not. I double checked that the customer passes correct reference assemblies, and it seems, it could be a bug in the Roslyn API.

@ericstj could you please review this work around. Once @ViktorHofer returns from his vacation, I will communicate the problem with him.

@ericstj
Copy link
Member

ericstj commented Apr 5, 2023

This is a work around solution for the #31570 issue to unblock the A&D team.

Unblocking can always happen with a partial file definition, right?

Do we know where the root cause of this bug lies? Is it a problem in SyntaxGenerator? If we know we should file an issue and link to it in the workaround.

Can you add a test case that covers the scenario?

@andriipatsula andriipatsula changed the title GenAPI: a work around for a generation an explicit interface implementation indexer. [WIP] GenAPI: a work around for a generation an explicit interface implementation indexer. Apr 6, 2023
@andriipatsula andriipatsula added Area-GenAPI and removed Area-Infrastructure untriaged Request triage from a team member labels Apr 6, 2023
@andriipatsula
Copy link
Member Author

@ericstj Thank you for the feedback. The problem is either in the Roslyn API or in the SBRP (Source-Build-Reference-Package) generator. I agree that the solution is not 100% clear and not in the best code style. I wrote an algorithm for the @MichaelSimons 's team how to build a local version of the GenAPI from the PR, prepare a nuget package and use it in the SBRP generator. I'll close this PR soon (without merging).

@ericstj
Copy link
Member

ericstj commented Apr 6, 2023

@andriipatsula I'm OK with us taking the workaround, I was just hoping for a test case and an answer to those questions so that we can understand the urgency. I'll see if I can pick this up and fill in.

@ericstj
Copy link
Member

ericstj commented Apr 9, 2023

I couldn't get this to fail. The following test passes for me: #31678

@ericstj
Copy link
Member

ericstj commented Jul 28, 2023

It wasn't failing because we were testing with source symbols at this point. If we test wit metadata symbols it works correctly. I'll resurrect this workaround.

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

Successfully merging this pull request may close these issues.

2 participants