Element session@0 already read to the end



Element session@0 already read to the end

I'm working with WinSCP from C# in a Windows Service to transfer files between Server and client.

It has been working good for a while.but these days,it goes into an error like
Element session@0 already read to the end

I will post the stack trace below, hope for some clue. I don't have access to the logs now, please help!

System.InvalidOperationException: Element session@0 already read to the end
   在 WinSCP.ElementLogReader.Read(LogReadFlags flags)
   在 WinSCP.SessionElementLogReader.Read(LogReadFlags flags)
   在 WinSCP.CustomLogReader.TryWaitForNonEmptyElement(String localName, LogReadFlags flags)
   在 WinSCP.CustomLogReader.WaitForNonEmptyElement(String localName, LogReadFlags flags)
   在 WinSCP.Session.GetFiles(String remotePath, String localPath, Boolean remove, TransferOptions options)

the source code as below

public override bool Read(LogReadFlags flags)
            if (_read)
                throw Session.Logger.WriteException(
                    new InvalidOperationException(
                        string.Format(CultureInfo.CurrentCulture, "Element {0} already read to the end", _token)));

            bool result = _parentReader.Read(flags);

            if (result &&
                IsEndElement(_localName) &&
                (Depth == _depth))
                result = false;
                Session.Logger.WriteLineLevel(1, "Element {0} read to the end", _token);
                _read = true;

            return result;

From the source code I can get that this error happened because of the _read was changed to true, but I don't know in what condition can it be changed.

Reply with quote



You can post new topics in this forum