I think that this question is just a variation of your previous question ( http://forum.rebex.net/8366/how-to-open-filenode-in-stream-for-further-transition ).
Your implementation of the GetNodeSurrogate event handler leads directly to the realm of the undefined behavior. The DirectoryNode("/", null) is a pseudo-root node in the "detached" state. Detached state means that this node is not associated with any FileSystemProvider and such node is invalid. Exception or surprising behavior are direct consequences when a FileServer tries to use this "fake" node.
GetNodeSurrogate event can be called many times for single request (or path) and it is expected that the behavior of the GetNodeSurrogate is consistent (e. g. returning node with path "/" instead of the node with expected path "one/two/three/" is inconsistent) and unsurprising.
What is worse? GetNodeSurrogate event is not called for root path ("/").
We have GetRootDirectorySurrogate event in our internal API, but we intentionally hide it.
GetNodeSurrogate event is a very low-level event. E. g. GetNodeSurrogate event can be utilized in unit tests for the custom file system provider, because you return mock instead of the resource-hungry real objects, but I have serious doubts that GetNodeSurrogate is useful for your scenario. Surrogate event should be generally used for tweaking the behavior of the existing file system provider, not for heavy random hacking.
Let me summarize your real "business" problem and correct me, please, if I am wrong. Forget the GetNodeSurrogate event for now.
1) You need to save content of the uploaded file on the "remote" server.
2) You are using sftp client and sftp client expects full-fledged file system on "local" server. You have to respond on "get file" request etc.
Please note that I anticipated point 2 and I already wrote about it in my previous answer:
Please be aware that for the SFTP server you should have full-fledged file system (built-in LocalFileSystemProvider/MemoryFileSystemProvider or custom file system provider for the remote server or custom file system provider that combines characteristics of the local and remote file system behavior).
What are your options? I think that you still have the same options (http://forum.rebex.net/8366/how-to-open-filenode-in-stream-for-further-transition) and there is not magical shortcut based on erroneous implementation of the event handlers.
1) LocalFileSystemProvider ( https://www.rebex.net/file-server/features/virtual-file-systems.aspx#local-provider ) with persistent file system structure and file stubs (see my previous comments for pros and cons).
2) MemoryFileSystemProvider ( https://www.rebex.net/file-server/features/virtual-file-systems.aspx#memory-provider ) with transient file system structure and file stubs (see my previous comments for pros and cons).
3) Custom file system provider (sample https://www.rebex.net/sample/file-server-custom-file-system/ ) for special "local sftp server" and "remote content server" relationship.