2

I'm practicing with graphql-dotnet. I created a PropertyQuery as follows:

public class PropertyQuery : ObjectGraphType
{
    public PropertyQuery(IPropertyRepository propertyRepository)
    {
        Field<ListGraphType<PropertyType>>(
            "properties",
            resolve: context => propertyRepository.GetAll()
        );

        Field<PropertyType>(
            "property"
            , arguments: new QueryArguments(new QueryArgument<IntGraphType> { Name = "id" })
            , resolve: context => propertyRepository.GetById(context.GetArgument<int>("id"))
         );
    }
}

Problem occurred with intellisense of Visual Studio (2019). When I passed resolve parameter of Field method, the intellisense not suggests GetArgument or Source etc... of ResolveFieldContext<TSource>, instead, it suggests like:

enter image description here

I am confused whether this is a error of visual studio, or the graphql-dotnet library has a problem. I'm a newbie in graphql, and if intellisense suggestions is wrong, I can't continue to practice

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Minh Giang
  • 631
  • 9
  • 28
  • Ahh, it's a visual studio 2019 bug. I opened my project in vs2017 and the problem disappeared. – Minh Giang Nov 19 '19 at 03:48
  • Hi, do you created the project in VS2017? As I know, some info about Intellisense function are stored in hidden .vs folder in solution directory. So if you have an project created in VS2017, and open it in VS2019, sometimes the migration breaks the Intellisense. You can delete the .vs folder and restart VS2019 to check if it persists :) – LoLance Nov 19 '19 at 06:09
  • @LanceLi-MSFT No, I created the project in vs2019 Enterprise – Minh Giang Nov 19 '19 at 07:04

2 Answers2

2

I am confused whether this is a error of visual studio, or the graphql-dotnet library has a problem.

There's possibility that this is one issue with VS2019 since same project in VS2017 works well...

I can now reproduce same issue in my machine. Since this issue occurs only when we use VS2019 to develop the project with Graphql package, I think it could be one issue about VS2019 Intellisense. (Create and develop the project in VS2017, all works well. Open it in VS2019, the issue occurs)

So I've just reported this issue in DC forum as a workaround. Here is the link where you can track it. Please visit the link and vote on the issue so you can get notifications on progress. Hope it makes some help :)

LoLance
  • 25,666
  • 1
  • 39
  • 73
  • Thank you so much. Hope the VS team will solve this problem soon :) – Minh Giang Nov 22 '19 at 07:42
  • I guess it may take some time before the fix, good news is that it only destroyed part of the Intellisense in GraphQL assemblies in VS2019, so we may choose to use VS2017 temporarily or bear the wrong suggestion cause the build system actually works well. (build system is different from Intellisense option). Hope the fix comes soon! – LoLance Nov 22 '19 at 07:46
  • Today, vs2019 v16.4.0 was released. But they did not fix this issue – Minh Giang Dec 04 '19 at 03:15
0

Thank you for reporting this! This is a bug in the way the C# completion list infers the types of lambda parameters when the lambda is being passed as an argument. I've posted a minimal standalone repro here.

In your example, completion should work as expected if you include the description argument (thus aligning the resolve argument with the corresponding resolve parameter on the other side). Can you please give this a try?

David Poeschl
  • 864
  • 4
  • 11