Block Disconnection/Re-connection results in compile failure and IndexOutOfRangeException error
Gondola
SDK: VRCSDK3-2019.12.21.16.01
UDON: UDONSDK-2019.12.22.12.32_Public
When using Update and Blocks, non-sequentially disconnecting connections outputting from the block(not disconnecting in order of last connected) results in compile failure and a removal of all previous connections between most if not all nodes; the issue seems to stem from the update and block nodes themselves as when removed(and replaced with identical nodes) the graph regains its ability to compile with no accompanying errors. An IndexOutOfRangeException error, in console, accompanies this issue and seems to precipitate it as a result of something breaking with the block node when altered in a disorderly fashion. Very frustrating, if rerouting block connections is required at some point it cannot be easily done without ruining whole graphs(unless backed up).
Log In
naqtn
Additional info: I could reproduce this issue and found:
- Pressing "Reload Graph" button also can cause this issue.
- This seems happen when a Block node has more than or equal to two unconnected output flows before last connected one.
- Even this happens, previous connections remain in data. It's a problem of view.
- Which connections disappear is depending on the order in which nodes are added.
- Once this happens, you can't delete the Block successfully. It appears again when reloaded.
- Stack trace on UDONSDK-2020.01.14.10.47
IndexOutOfRangeException: Index was outside the bounds of the array.
VRC.Udon.Editor.UdonNode.PopulateEdges () (at Assets/Udon/Editor/ProgramSources/UdonGraph/UdonNode.cs:149)
VRC.Udon.Editor.UdonGraph.Reload () (at Assets/Udon/Editor/ProgramSources/UdonGraph/UdonGraph.cs:516)
VRC.Udon.Editor.UdonGraphWindow.DrawToolbar () (at Assets/Udon/Editor/ProgramSources/UdonGraph/UdonGraphWindow.cs:227)
VRC.Udon.Editor.UdonGraphWindow.OnGUI () (at Assets/Udon/Editor/ProgramSources/UdonGraph/UdonGraphWindow.cs:140)
Observer.
I think I've received the same error while moving around connections for debugging, or deleting nodes, but I am yet to have a whole graph ruined. I'm not an Udon dev but can you please share a simple graph with reproducible instructions for this issue? More so because I am curious as to why my whole graph doesn't break, but if there is a bug that causes an issue with the whole graph it would be good to help replicate it.
Gondola
Observer.: this is a simple movement graph that requires a bit of update checking through a block, this should break when you A: disconnect a connection from the middle of the update block and after that B: reload the graph or attempt to compile
Observer.
Gondola: Thank you for sharing. I understand what you mentioned now. It looks like the way the Block node handles removing empty flow connections when it tries to remove more flow connections than what are available in the array as an empty index. I only found issues with your graph when I tried to remove two flow connections out of order because in this situation the second last flow connection in the index was occupied. Meaning it only had one index available to remove while it probably tries to remove two. Whereas when I removed one flow connection it just removed the empty flow connection index from the bottom of the Block node, and so you have to do it twice for the array index to not have the empty index anymore. Just seems to be a mistake in how the array is handled when trying to remove/reorder itself when as you say the connections are altered out of order.
So my guess is it is failing in a situation where it tries to remove more empty connections than are available within the index. Might be something to do with how the empty connection can be removed from the array, thus causing the array to be one less than expected. One would expect the Block node to always have an empty index for the user to connect to. That empty index gets deleted when altering the Block connections out of order it seems.
At least that is what I gathered quickly looking over your graph. They probably just need to ensure that the empty index for the user to connect to is always there to avoid the change in array size. Good find on the bug.
Quick edit: I did get it to break with only removing one flow connection, but its more consistent when removing two.
Observer.
I guess I had a weird situation where the empty flow connection just disappeared from my Block node. Certainly just remove the top two flow connections from the block, compile, then reopen the graph to get the error consistently.
Foorack
Observer.: Yes, following is a simple graph, where either pressing play or switch to another Udon graph and back, all lines in this example graph will disappear. This seems to be specific to the 0'th index/output of the Block node. Connecting anything to the first output flow of the Block node and refreshing the window makes all lines come back.