SyncVar hook not being called by getter/setter

I attached a hook to one of my SyncVars, but the function does not get called when I use a setter to change the variable. Is this a bug? Or am I just doing something wrong?

Sometimes if you are setting the variables in your Start() function, they do not get updated. But maybe something is wrong in your implementation? Could you share some code pieces with us?

if (Input.GetKeyDown (KeyCode.M))){          
    workStation.Test = true; // this does not call the hook function
}
if (Input.GetKeyDown (KeyCode.N))){           
    workStation.test = true; // this calls the hook function
}
[SyncVar(hook="OnTest")]
public bool test = false;

public bool Test {
    get {
        return test;
    }
    set {
        test = value;
    }
}

There is an explanation from a unity dev about this within this thread: Network Identity 'observers' don't match expectation - Unity Engine - Unity Discussions

From here:

Note that setting a SyncVar member variable inside a property setter function does not cause it to be dirtied. Trying to do this will cause a compile time warning. Because SyncVars use properties internally to mark themselves as dirty, setting them dirty inside property functions could lead to recursion problems.

Also, I note from using it that the hook function is only called if the variable value actually changes, so your keypress above setting it to true, would only fire the hook the first time KeyCode.M is pressed.

also that looks like client code… you can only set syncvars on the server…

I see. I just simplified my example so it was easier to read here, but that is good to know. Thanks!