Jump to content


p4api.net exception in P4Server.LastResults setter

C# p4api .net

  • Please log in to reply
2 replies to this topic

#1 gharding3

gharding3

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 20 November 2013 - 08:42 PM

There is an exception being thrown by an internal function in version 2013.1 of p4api.net

System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Generic.Dictionary`2.KeyCollection.Enumerator.MoveNext()
at Perforce.P4.P4Server.set_LastResults(P4CommandResult value) in c:\tmp\30745224\P4.NET\r13.2\p4api.net\p4api.net\P4Server.cs:line 129
at Perforce.P4.P4CommandResult..ctor(P4Command cmd, StringList flags) in c:\tmp\30745224\P4.NET\r13.2\p4api.net\p4api.net\P4CommandResult.cs:line 155
at Perforce.P4.P4Command.Run(StringList flags) in c:\tmp\30745224\P4.NET\r13.2\p4api.net\p4api.net\P4Command.cs:line 444
at Perforce.P4.Repository.GetChangelist(Int32 changeId, Options options) in c:\tmp\30745224\P4.NET\r13.2\p4api.net\p4api.net\Repository.Changelist.cs:line 312

It looks like a bug.  The setter code for P4Server.LastResults is removing dictionary items during an enumeration of the dictionary keys.

#2 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 21 November 2013 - 06:15 AM

Yup, looks like a bug. I'll file an issue. Do you happen to have a code snippet lying around that exercises the bug?

#3 dtrudeauwb

dtrudeauwb

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 13 February 2015 - 04:48 PM

I'm actually seeing this error using p4api.net version 2014.2.  It seems to hit after a P4Server instance has been kept around long enough to acquire a lot of results in the "last results" cache internally.

Is there a clean way to work around this issue until it's addressed, perhaps other than recycling the P4Server instance on a regular basis?





Also tagged with one or more of these keywords: C#, p4api, .net

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users