I am working on virtual channels(using C#) using Vanara.PInvoke and I got similar error. Were you able to fix this? If so can you please guide through how you solved it.
I check few threads in ChatGpt/Copilot. Also did research on google for any documentation using Vanara.PInvoke. For any reason it is giving Invalid Channel for method WTSVirtualChannelOpenEx.
ChatGpt asked me to validate Session and Virtual Channel Name registration. I am passing WTS_CURRENT_SESSION and for VC, I have registrated in HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\Addins path(in VM where I need to transfer file) in regedit as per Microsoft website. Still the issue persists.
Please let me know, if anything is missing or need to check in any other direction.