Just to explain what is going on, if you open up FlowNode.cs and take a look at the “GatherPorts” method, you will see that “RegisterPorts” is called within, and right after that, the “DeserializeInputPortValues” is called. If of course an exception is thrown within the RegisterPorts implementation, the “DeserializeInputPortValues” is never called and thus the port values (of this particular node) are lost since the graph is then serialized back.
There is an exception handling per node registration (so that if one node throws an exception the rest proceed normally), but to avoid what is happening in a per-node basis when an exception is thrown, there will need to exist yet another exception handling. Changing the “GatherPorts” method to be like the following will effectively work the way you suggest (make port serialization perist):