Elvas Tower: Error: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. - Elvas Tower

Jump to content

  • 4 Pages +
  • « First
  • 2
  • 3
  • 4
  • You cannot start a new topic
  • You cannot reply to this topic

Error: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. crash when a train reach a track section Rate Topic: -----

#41 User is offline   gpz 

  • Superintendant
  • Group: Posts: Elite Member
  • Posts: 1,846
  • Joined: 27-October 12
  • Gender:Male
  • Location:Budapest
  • Simulator:OpenRails
  • Country:

Posted 22 January 2015 - 09:35 AM

I can confirm, disc's timetable still doesn't work, however something has been changed, since the exception now occurs at loading time, not at mid-game. (The error can be reproduced with train 2117.) The good news is that the temporary workaround with commenting out the "break" in SearchPassingPaths function still applies. By logging the nextElement variable received from SetTrainDetails for train number 0 I can see, that there are still two -1 values are received at the beginning of its path as the first two values, and the real non-negative nextElements follow only these ones.

#42 User is offline   roeter 

  • Vice President
  • Group: Posts: Elite Member
  • Posts: 2,453
  • Joined: 25-October 11
  • Gender:Male
  • Country:

Posted 22 January 2015 - 09:57 AM

This was indeed very much a brother of the first bug - a twin brother, in fact, for the problem was in the same method, and very much the same type of error - incorrect return of state 'end of path reached', which meant that any following passing paths were not processed.
However, the situation in which this now occured is something which, admittedly, had never crossed my mind : it happened when a train starts within a passing path area. Personally, I would never set up such an arrangement, but it is ofcourse possible and allowed.
Version 2809 is now clear of this little beastie.

Let's hope that bug does not have a whole nest of further siblings ... :wallbash:

Regards,
Rob Roeterdink

#43 User is offline   pmoser 

  • Apprentice
  • Group: Posts: Switchman
  • Posts: 16
  • Joined: 31-January 13
  • Gender:Male
  • Simulator:Open Rails
  • Country:

Posted 22 January 2015 - 06:14 PM

Rob,

Version 2809 seems to have fixed the problem. I've run every test were I used to have problems before and everything works perfectly now. I even checked "Location-linked passing path processing" in Experimental options and everything runs fine. Before, when I checked that option, it would effect a lot more paths then without it checked.

You mentioned about starting a train within a passing path as one of the causes of this problem. I'm not aware of any of my paths doing this and I don't know how you can even set that up as I think the only way to set a passing path is to go through it unless I misinterpreted your statement. Thanks again for your work in resolving this bug and for the timetable concept in general.

I've noticed another minor (cosmetic) bug which is not related to this, but since it would affect only timetable operation, I figure I would use the same thread. At the beginning of the day, I stage four Coaster commuter trains at Stuart Mesa for the morning rush. All these are playable services vs. inbound moves. If you select either "C630" or "C636" for the player train, the trains behind it (C634 and C638 respectively) will run up and into whichever train you are running. If the computer is running those trains, this does not happen as viewed on the dispatcher screen. You can see this if you select either "C630" or "C636" and look at the back of your train.

Phil

#44 User is offline   disc 

  • Foreman Of Engines
  • Group: Private - Open Rails Developer
  • Posts: 818
  • Joined: 07-October 12
  • Gender:Male
  • Simulator:OpenRails
  • Country:

Posted 23 January 2015 - 05:51 AM

View Postroeter, on 22 January 2015 - 09:57 AM, said:

This was indeed very much a brother of the first bug - a twin brother, in fact, for the problem was in the same method, and very much the same type of error - incorrect return of state 'end of path reached', which meant that any following passing paths were not processed.
However, the situation in which this now occured is something which, admittedly, had never crossed my mind : it happened when a train starts within a passing path area. Personally, I would never set up such an arrangement, but it is ofcourse possible and allowed.
Version 2809 is now clear of this little beastie.

Let's hope that bug does not have a whole nest of further siblings ... :)

Regards,
Rob Roeterdink


OMG it works now :spiteful: Thanks!

So you say that error error caused not by the running train but a starting one? Then i looked the opposite direction all time ;) i watched the intercity, but the error is caused by a starting regional train?


Edit: not everything works :furiousPC: the crash when the player is following an AI train still there, at same place.
Error: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at ORTS.DeadlockInfo.GetEndSection(Train thisTrain) in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Signals\Signals.cs:line 12616
   at ORTS.DeadlockInfo.CheckDeadlockPathAvailability(TrackCircuitSection startSection, Train thisTrain) in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Signals\Signals.cs:line 12127
   at ORTS.SignalObject.getBlockState_locationBased(TCSubpathRoute thisRoute, TrainRouted thisTrain) in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Signals\Signals.cs:line 9869
   at ORTS.SignalObject.getBlockState(TCSubpathRoute thisRoute, TrainRouted thisTrain) in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Signals\Signals.cs:line 9594
   at ORTS.SignalObject.checkRouteState(Boolean isPropagated, TCSubpathRoute thisRoute, TrainRouted thisTrain) in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Signals\Signals.cs:line 9243
   at ORTS.SignalObject.requestClearSignal(TCSubpathRoute RoutePart, TrainRouted thisTrain, Int32 clearNextSignals, Boolean requestIsPropagated, SignalObject lastSignal) in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Signals\Signals.cs:line 9175
   at ORTS.SignalObject.propagateRequest() in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Signals\Signals.cs:line 9465
   at ORTS.SignalObject.Update() in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Signals\Signals.cs:line 8620
   at ORTS.Signals.Update(Boolean preUpdate) in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Signals\Signals.cs:line 546
   at ORTS.Simulator.Update(Single elapsedClockSeconds) in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Simulator\Simulator.cs:line 500
   at ORTS.Viewer3D.Viewer.Update(RenderFrame frame, Single elapsedRealTime) in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Viewer3D\Viewer.cs:line 534
   at ORTS.Processes.GameStateViewer3D.Update(RenderFrame frame, Double totalRealSeconds) in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Processes\GameStateViewer3D.cs:line 122
   at ORTS.Processes.UpdaterProcess.Update() in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Processes\UpdaterProcess.cs:line 128
   at ORTS.Processes.UpdaterProcess.DoUpdate() in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Processes\UpdaterProcess.cs:line 108
   at ORTS.Processes.UpdaterProcess.UpdaterThread() in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Processes\UpdaterProcess.cs:line 74
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()


This happens with train 2117 on same route and timetable shortly after the second passenger stop, when passing a signal. Only happens if the train is driven by player.

Edit2: funny... this error happens even if the player not following any AI train. The only trains around are going to the opposite direction, on the other track.
Here are two a saves (revision 2811): Attached File  save.zip (4.97MB)
Number of downloads: 233 shortly after loading them the crash will happen.

#45 User is offline   gpz 

  • Superintendant
  • Group: Posts: Elite Member
  • Posts: 1,846
  • Joined: 27-October 12
  • Gender:Male
  • Location:Budapest
  • Simulator:OpenRails
  • Country:

Posted 23 January 2015 - 09:38 AM

Disc, have you restarted the game from the beginning with the latest revision? The database is built up at game start, so if you reload a game saved with the older revision that contained the affected code, then the error will appear again, because the wrong database is just reloaded from disk in this case.

Edit: Yes it happens to me too. The startup exception has gone, but the in-game remained. Looks like the family of this bug is quite large. :)

#46 User is offline   gpz 

  • Superintendant
  • Group: Posts: Elite Member
  • Posts: 1,846
  • Joined: 27-October 12
  • Gender:Male
  • Location:Budapest
  • Simulator:OpenRails
  • Country:

Posted 23 January 2015 - 10:05 AM

Logging again the usual nextElement in SearchPassingPaths of train with trainNumber 0 I can see the following values respectively: 4, -1, 42, 72, 98, 132, 180, 209.
So the first wrong -1 has gone at the beginning, but the second one remained. The remaining of the real path is following the 2nd -1, as before. The usual workaround still works: commenting out the "break".

#47 User is offline   disc 

  • Foreman Of Engines
  • Group: Private - Open Rails Developer
  • Posts: 818
  • Joined: 07-October 12
  • Gender:Male
  • Simulator:OpenRails
  • Country:

Posted 24 January 2015 - 01:14 PM

Ok, but commenting out the break is not the best solution, and that won't be in releases :crazy:
What i don't understand is why this error happens even if i remove all passing paths at that area?

#48 User is offline   gpz 

  • Superintendant
  • Group: Posts: Elite Member
  • Posts: 1,846
  • Joined: 27-October 12
  • Gender:Male
  • Location:Budapest
  • Simulator:OpenRails
  • Country:

Posted 24 January 2015 - 01:20 PM

Yes, I'm writing that commenting-out thing to Rob only, so that he knows where to start searching for the bug. :crazy:
Probably removing passing paths is of no help because the bug is no more with wrong passing path detection, it must be something close but different thing.

#49 User is offline   disc 

  • Foreman Of Engines
  • Group: Private - Open Rails Developer
  • Posts: 818
  • Joined: 07-October 12
  • Gender:Male
  • Simulator:OpenRails
  • Country:

Posted 25 January 2015 - 07:24 AM

But why this isn't happen if the train is driven by AI? That's an X-file for me.

#50 User is offline   roeter 

  • Vice President
  • Group: Posts: Elite Member
  • Posts: 2,453
  • Joined: 25-October 11
  • Gender:Male
  • Country:

Posted 26 January 2015 - 02:51 AM

Further corrections made to the search for matching paths logic (version 2818), which at least removes one further member of this rather obstinate family of bugs.

@disc : the way this error worked was quite complex. The problem was not at the location where the crash occured, nor was it fully caused by the train which caused the crash. And the sequence in which the trains were processed also affected the outcome.
The problem was basically that at least one train had a path which partially overlapped an alternative path as defined for another train.

Regards,
Rob Roeterdink

#51 User is offline   disc 

  • Foreman Of Engines
  • Group: Private - Open Rails Developer
  • Posts: 818
  • Joined: 07-October 12
  • Gender:Male
  • Simulator:OpenRails
  • Country:

Posted 26 January 2015 - 12:04 PM

Another problem, but this looks slightly different. However the timetable worked on revision 2813 without problem, but not with 2819

 Run AI : 198  01:00  02:00  03:00  04:00  05:00 

Error: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at ORTS.Train.SetDeadlock_locationBased(Int32 thisIndex, TCSubpathRoute thisRoute, TCSubpathRoute otherRoute, Train otherTrain) in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Physics\Train.cs:line 9736
   at ORTS.Train.CheckDeadlock_locationBased(TCSubpathRoute thisRoute, Int32 thisNumber) in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Physics\Train.cs:line 9515
   at ORTS.Train.CheckDeadlock(TCSubpathRoute thisRoute, Int32 thisNumber) in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Physics\Train.cs:line 9275
   at ORTS.AITrain.PostInit() in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\AI\AITrain.cs:line 394
   at ORTS.AI.AddToWorld(AITrain thisTrain) in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\AI\AI.cs:line 563
   at ORTS.AI.AIUpdate(Single elapsedClockSeconds, Boolean preUpdate) in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\AI\AI.cs:line 381
   at ORTS.AI.PrerunAI(Int32 playerTrainOriginalTrain, Train playerTrain, LoaderProcess loader) in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\AI\AI.cs:line 253
   at ORTS.AI..ctor(Simulator simulator, List`1 allTrains, Double ClockTime, Int32 playerTrainOriginalTrain, Train playerTrain, LoaderProcess loader) in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\AI\AI.cs:line 128
   at ORTS.Simulator.StartTimetable(String[] arguments, LoaderProcess loader) in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Simulator\Simulator.cs:line 298
   at ORTS.Processes.GameStateRunActivity.Start(UserSettings settings, String acttype, String[] args) in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Processes\GameStateRunActivity.cs:line 274
   at ORTS.Processes.GameStateRunActivity.<>c__DisplayClass8.<Load>b__3() in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Processes\GameStateRunActivity.cs:line 148
   at ORTS.Processes.GameStateRunActivity.Load() in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Processes\GameStateRunActivity.cs:line 189
   at ORTS.Processes.LoaderProcess.Load() in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Processes\LoaderProcess.cs:line 155
   at ORTS.Processes.LoaderProcess.DoLoad() in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Processes\LoaderProcess.cs:line 136
   at ORTS.Processes.LoaderProcess.LoaderThread() in e:\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Processes\LoaderProcess.cs:line 107
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()


This happens after 5:00 in pre-run. Here is the timetable: Attached File  timetablehossz.zip (47.83K)
Number of downloads: 227

#52 User is offline   roeter 

  • Vice President
  • Group: Posts: Elite Member
  • Posts: 2,453
  • Joined: 25-October 11
  • Gender:Male
  • Country:

Posted 27 January 2015 - 01:31 PM

Can you please upload the timetable_or file as UNICODE?
The way it is, path etc. look like this on my system : TTAF6 Nyugati-Vác
Station names are molested accordingly, e.g. Vilmaszállás mh
It is a :sign_thanks: of a job to sort that all out.

Regards,
Rob Roeterdink

#53 User is offline   disc 

  • Foreman Of Engines
  • Group: Private - Open Rails Developer
  • Posts: 818
  • Joined: 07-October 12
  • Gender:Male
  • Simulator:OpenRails
  • Country:

Posted 27 January 2015 - 02:10 PM

View Postroeter, on 27 January 2015 - 01:31 PM, said:

Can you please upload the timetable_or file as UNICODE?
The way it is, path etc. look like this on my system : TTAF6 Nyugati-Vác
Station names are molested accordingly, e.g. Vilmaszállás mh
It is a :sign_thanks: of a job to sort that all out.

Regards,
Rob Roeterdink


It's UTF-8 already. Saved as UTF-8, and total commander's viewer, notepad, notepad++, libreoffice calc all detect and load it as UTF-8. For me those characters appear if i change the encoding to a non UTF encoding, for example ANSI. You trying to open it in MS office? I hear that have problems with UTF encodings.

#54 User is offline   roeter 

  • Vice President
  • Group: Posts: Elite Member
  • Posts: 2,453
  • Joined: 25-October 11
  • Gender:Male
  • Country:

Posted 27 January 2015 - 02:35 PM

Perhaps the UTF-8 gets lost when packing into or unpacking from the zip-file, but with whatever program I look at it (including a HEX dump program - and those never lie), it definitely is not UTF-8.

Regards,
Rob Roeterdink

#55 User is offline   disc 

  • Foreman Of Engines
  • Group: Private - Open Rails Developer
  • Posts: 818
  • Joined: 07-October 12
  • Gender:Male
  • Simulator:OpenRails
  • Country:

Posted 27 January 2015 - 02:51 PM

If i download that zip, it's still UTF-8 for all of my applications. How can i save it to be more UTF-8? :sign_thanks:
Have you tried notepad++? That opens anything as should. Maybe you need UTF-8+BOM (which is non standard)?
Try this: Attached File  Alföld6.zip (8.88K)
Number of downloads: 206 i bet this is the problem. It seems at microsoft they still didn't read the specifications of UTF, as BOM(0xEF 0xBB 0xBF in hex) is not needed nor recommended, but still used by microsoft :D

  • 4 Pages +
  • « First
  • 2
  • 3
  • 4
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users