question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OfType<T>() is broken

See original GitHub issue

Describe the bug I am trying to implment a wrapper around your client and am running into issues w/the OfType<T>() method. I’m trying to replicate the How_many_pets_does_everybody_have() method from the test project. I am getting a different result than you are. I am pointing to the same Database and Graph and have the same object model in both projects.

The OfType<T>() when T is a base class (i.e., Pet) is expected to reflect and determine any classes that inherit from it and should return a list of Types (i.e., Dog, Cat, Pet).

Your test project produces: V().hasLabel('Person').out('Owns').hasLabel('Cat','Dog','Pet') which is correct and what I expect.

My implementation produces: V().hasLabel('Person').out('Owns').hasLabel('Pet') which is incorrect.

I have the same exact code, same class model, but different output. I tried cloning your repo and fixing whatever the issue is in the OfType<T>() extension but the solution won’t build.

Here is my code and some screenshots showing what’s going on:

  1. My code is on left
  2. Your sample project is on the right
  3. You will see that I don’t get Cat or Dog

image

Pet image

Mammal image

Vertex image

Dog image

Cat image

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:27 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
danielcwebercommented, Apr 5, 2022

For an ASP WebApi, you’re probably better off with the other sample app.

1reaction
danielcwebercommented, Apr 4, 2022

For the ExRam.Gremlinq project not building, I cannot reproduce. Everything builds fine in VS 2022 and on the build server.

In your sample code, the only configuration of a GraphModel is, for whatever reason, commented out and reads

GraphModel
    .FromBaseTypes<Vertex, Edge>(lookup => lookup
        .IncludeAssembliesOfBaseTypes())

Gremlinq has no ability to lookup all the Pet-derived classes when it only considers the assembly of Vertex and Edge, which are not in the same assembly as Pet or anything else, as far as I can see. There’s a method to include more assemblies.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix Type 'string' is not assignable to type 'T[keyof T]'
Now everything works as desired. With prop as type K , and val as type T[K] (the type you get when you index...
Read more >
uvm_pool get() function. Is it broken?
The get() is supposed to return a pointer to a uvm_object of type T if there is no object of type T at...
Read more >
GenericArguments[0] ... violates the constraint of type 'T ...
PS C:\> Resolve-AzError -Last WARNING: Upcoming breaking changes in the cmdlet 'Resolve-AzError' ... <ExecuteCmdlet>b__40_0() at Microsoft.
Read more >
Breaking Changes · microsoft/TypeScript Wiki
For breaking changes to the compiler/services API, please check ... Argument of type 'T' is not assignable to parameter of type 'object'.
Read more >
Reflections, Broken Promises and Fake generics: the anti ...
() -> a must be able to create a value for ANY type out of NOTHING. ... a complex object of type T...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found