Coder Social home page Coder Social logo

Comments (7)

gwaredd avatar gwaredd commented on July 28, 2024 2

Done.

In the event there are multiple functions with the same number of arguments it'll call the first one. Acceptable?

from unium.

gwaredd avatar gwaredd commented on July 28, 2024

Under-the-hood it's a Type.GetMethod(string) call, which throws if there are multiple methods with the same name.

It could potentially be a bit more clever and try to match the arguments in the query to a function signature. However, as this would be trying to match strings with underlying types there will always be some ambiguity (e.g. is "123" an int or a float?). It will also be slower and move convoluted code.

The most expedient solution is to rename the functions or add a test hook that shims the underlying implementation. If you think there is a strong case for unium handling some of the ambiguity I'll give it some consideration ;)

from unium.

bryandickson avatar bryandickson commented on July 28, 2024

from unium.

gwaredd avatar gwaredd commented on July 28, 2024

If you're working with async code take a look at UniTask.

Unium can invoke UniTask functions as normal, the query will then exit and the functions will execute asynchronously. This means the results aren't returned to the query but you can all the functions, which may be good enough for some things.

If you want the results returned in the query then there is some work to do. There's various ways to do this with varying degrees of effort and elegance.

from unium.

gwaredd avatar gwaredd commented on July 28, 2024

Alternatively you use callbacks to raise an event if you are using websockets.

from unium.

lacostej avatar lacostej commented on July 28, 2024

We are hitting this as well.

If we were to improve the heuristic to only find the method that has the same number of parameters, in the case there is only one, would that be an acceptable change? It would have a limited performance impact and increase the amount of supported cases

from unium.

Ekareya avatar Ekareya commented on July 28, 2024

The use case that @lacostej and me are hitting is on this function :
https://docs.unity3d.com/2019.3/Documentation/ScriptReference/Camera.WorldToScreenPoint.html
which have two different methods.
In my use case, to Automate some test, I am using Unium as the "eye" and Appium as the "hand", so this function is a must-have,

Anyway, in the meantime, I've patched it locally on my own by checking for the number of methods signatures and using getMethod(string,Type[]) instead for the relevant case.
I am getting my Type[] from the members parameters that have the right number of parameters and throwing an exception if I find multiple parameters signature with the same number or parameters.

It solves my issue with WorldToScreenPoint(), but it's not a catch-all as it still leaves out the case where you have more than one method with the same number of arguments.

from unium.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.