Git Product home page Git Product logo

Comments (4)

msporna avatar msporna commented on August 14, 2024

Thank you for reporting. I'll take a look and keep you posted

from lava-test-coverage.

msporna avatar msporna commented on August 14, 2024

I tried to reproduce by putting the following code into 1 of my unity c# scripts:

void CourtineStarter() {
        StartCoroutine(WaitForFrames(1, () => {
            Debug.Log("Lambda call");
        }));
    }

    public static IEnumerator WaitForFrames(int frames, Action callback) {
        for (int i = 0; i < frames; i++) {
            yield return new WaitForEndOfFrame();
        }
        callback();
    }

and it got instrumented so it's not related to lambdas:

void CourtineStarter() {
        LavaHelper.SendStats("MainController.cs","ce2e5759-c84f-4a6c-b883-6c8b7aa28baa","473","function");
        StartCoroutine(WaitForFrames(1, () => {
            Debug.Log("Lambda call");
        }));
    }

    public static IEnumerator WaitForFrames(int frames, Action callback) {
        LavaHelper.SendStats("MainController.cs","b81c2895-3353-4a14-9c4d-09c30818996b","479","function");
        for (int i = 0; i < frames; i++) {
            LavaHelper.SendStats("MainController.cs","a75067c6-724f-4069-be73-dd976512d226","480","loop");
            yield return new WaitForEndOfFrame();
        }
        callback();
    }

The exception you got is related to

 p = re.compile(r'(class)[\s]*[\w]+')
                    var = p.search(file_content[l])
                    if var is not None:
                        class_name = var.string[var.regs[0][0]:var.regs[0][1]].split(' ')[
                            1]

it relates to getting class name. Could you send me all class declarations from the script that causes the issue?

example:
public class MainController : MonoBehaviour

from lava-test-coverage.

mickwonnink avatar mickwonnink commented on August 14, 2024

It throws the error when handling this class:
public class GameManager : NetworkBehaviour {

which has this singleton inside it:

 private static GameManager instance;

    public static GameManager Singleton
    {
        get { return instance; }
        set
        {
            if (value.GetType().IsSubclassOf(typeof(GameManager)))
            {
                instance = value;
            }
        }
    }

Other scripts that inherit from NetworkBehaviour work fine btw.

from lava-test-coverage.

msporna avatar msporna commented on August 14, 2024

Fixed in commit 4459031dd8e8b4116fcc6cca6b569aeb4dc597e0

The problem was with
if (value.GetType().IsSubclassOf(typeof(GameManager))) and this regex responsible for getting class name:
(class)[\s]*[\w]+

it was detecting 'IsSubclassOf' string and tried to extract class name from it.

Updating regex to:
[\s]+(class)[\s]*[\w]+
fixed the issue.

Please reopen if it still exists for you. Thanks !

from lava-test-coverage.

Related Issues (8)

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.