"Unexpected data!" expection bubbles to the top and crashes program

Advertisement

Samy110
Guest

"Unexpected data!" expection bubbles to the top and crashes program

We are currently using WinSCP Version 5.21.5 via .NET Assembly and observing a tedious issue on one system in particular.

The following exception is sometimes thrown by the WinSCP .NET Assembly:
System.InvalidOperationException: Unexpected data  at 
WinSCP.ExeSessionProcess.ProcessTransferOutEvent(ConsoleTransferEventStruct e) at 
WinSCP.ExeSessionProcess.ProcessEvent()  at 
WinSCP.ExeSessionProcess.ProcessEvents()   at 
System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)   at 
System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)  at 
System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
at System.Threading.ThreadHelper.ThreadStart()
Normally exceptions are not a problem. But because this one is thrown in a thread managed entirely by the WinSCP .NET Assembly, it is very difficult to catch and crashes our program that spawned WinSCP in the first place.

We have session logs enabled, but unfortunately haven't found any matching timestamps (yet) between our crash logs and the WinSCP logs. So we don't know what exactly is causing WinSCP to throw this exception.

Looking through the WinSCPnet project, I would suggest to catch the exception and return a useful error back to the caller of the WinSCP .NET Assembly:
// Try... Catch.. here?
_thread = new Thread(ProcessEvents)
{
   IsBackground = true
};
 _thread.Start();
File "ExeSessionProcess.cs" Line 214

Thanks for your help.
- Sam

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,717
Location:
Prague, Czechia

Re: "Unexpected data!" expection bubbles to the top and crashes program

Please set Session.SessionLogPath and Session.DebugLogPath and post both logs once the problem occurs.

Reply with quote

Advertisement

You can post new topics in this forum