#Added Feature: Detecting Schedule() - calls through function invocation. How do I submit patch?

1 messages · Page 1 of 1 (latest)

pure lodge
#

I am currently trying to hunt down a bug in the SystemGenerator that fails to recognize calls to Schedule&Co if they are executed on an return value of a function directly.

Basically:


public partial struct TestSystem : ISystem
{
    public void OnUpdate(ref SystemState state)
    {
        var job = Create(ref state);
        job.Schedule(); // works

        Create(ref state).Schedule(); // broken

        new Job().Schedule(); // works (of course)
    }
    Job Create(ref SystemState state) => new();
    partial struct Job : IJobEntity { void Execute() { } }
}```

If I call .Schedule() (or Run or any other of these methods) directly on the return value of a function, the source generator fails to pick up and replace the call. 😮

I am currently "just staring" at some code, e.g. IjeSchedulingSyntaxWalker.VisitInvocationExpression or maybe inside JobEntityInstanceInfo.GetAndAddScheduleExpression..

Anyone has hints how to debug the SystemGenerator (or maybe where the actual issue is?) I tried setup a Rider launchsettings.json like I did for our own project source generators, but the dots entity one seems to be a bit more complicated to get running. Any howtos?
pure lodge
#

About the "how to start debugging" part... ye'ol' "Debugger.Launch" did the trick. Debugging now.. ^^

    {
        if (node.GetLocation().SourceTree.FilePath.Contains("WorkerSystem"))
        {
            Debugger.Launch();
        }
        if (_isWalkingSchedulingInvocationArgument)
        {
            if (_systemDescription.CandidateNodes.TryGetValue(node, out var candidateSyntax))
...
pure lodge
#

I think, I got it. I guess this one here from JobEntityModule.OnReceiveSyntaxNode is missing an "or InvocationExpressionSyntax"

pure lodge
#

well... turned out to be not really a "bug" or "just a forgotten or clause", but rather like "not implemented feature at all".

All the subsequent code does not care for calls of Schedule-like functions directly done on invocations..

I got some working thing together for our project, but... any way how I could submit this to Unity? (the fix is not super easy, as it also should support things like Create(ref state, SystemAPI.Time.DeltaTime).Schedule() so basically, I had to do the same self-calling-Visit()-switcheroo as was already done for the initializer list).

There seem to be no official repo on github for com.unity.entities package, so no easy pull-request.. or did I miss something?

#

Added Feature: Detecting Schedule() - calls through function invocation. How do I submit patch?

coarse current
#

@austere wyvern is the man you want to talk to

#

though it's always helpful to make a bug report, a lot easier to keep track of

pure lodge
#

by bug report, I assume you mean this integrated Unity bug reporter tool?

#

well.. created "CASE IN-101050" for that. 😄

Also, here's my patch (if anyone cares). Naturally, it lacks things like proper unit tests and stuff, but.. well. Sue me! 😛