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

Jump to content

  • 6 Pages +
  • 1
  • 2
  • 3
  • Last »
  • 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: -----

#1 User is offline   disc 

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

Posted 16 October 2014 - 08:35 AM

I'm having this error time to time. Mostly it was connected to passing paths(where i still don't know what is actually the problem), but now it happens on main path too.

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 c:\Users\James\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Signals\Signals.cs:line 11858
   at ORTS.DeadlockInfo.CheckDeadlockPathAvailability(TrackCircuitSection startSection, Train thisTrain) in c:\Users\James\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Signals\Signals.cs:line 11369
   at ORTS.SignalObject.getBlockState_locationBased(TCSubpathRoute thisRoute, TrainRouted thisTrain) in c:\Users\James\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Signals\Signals.cs:line 9368
   at ORTS.SignalObject.getBlockState(TCSubpathRoute thisRoute, TrainRouted thisTrain) in c:\Users\James\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Signals\Signals.cs:line 9108
   at ORTS.SignalObject.checkRouteState(Boolean isPropagated, TCSubpathRoute thisRoute, TrainRouted thisTrain) in c:\Users\James\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Signals\Signals.cs:line 8769
   at ORTS.SignalObject.requestClearSignal(TCSubpathRoute RoutePart, TrainRouted thisTrain, Int32 clearNextSignals, Boolean requestIsPropagated, SignalObject lastSignal) in c:\Users\James\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Signals\Signals.cs:line 8706
   at ORTS.SignalObject.propagateRequest() in c:\Users\James\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Signals\Signals.cs:line 8979
   at ORTS.SignalObject.Update() in c:\Users\James\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Signals\Signals.cs:line 8151
   at ORTS.Signals.Update(Boolean preUpdate) in c:\Users\James\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Signals\Signals.cs:line 537
   at ORTS.AI.PrerunAI(Int32 playerTrainOriginalTrain, Train playerTrain) in c:\Users\James\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\AI\AI.cs:line 216
   at ORTS.AI..ctor(Simulator simulator, List`1 allTrains, Double ClockTime, Int32 playerTrainOriginalTrain, Train playerTrain) in c:\Users\James\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\AI\AI.cs:line 125
   at ORTS.Simulator.StartTimetable(String[] arguments) in c:\Users\James\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Simulator\Simulator.cs:line 288
   at ORTS.Processes.GameStateRunActivity.Start(UserSettings settings, String acttype, String[] args) in c:\Users\James\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Processes\GameStateRunActivity.cs:line 277
   at ORTS.Processes.GameStateRunActivity.<>c__DisplayClass8.<Load>b__3() in c:\Users\James\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Processes\GameStateRunActivity.cs:line 149
   at ORTS.Processes.GameStateRunActivity.Load() in c:\Users\James\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Processes\GameStateRunActivity.cs:line 190
   at ORTS.Processes.LoaderProcess.Load() in c:\Users\James\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Processes\LoaderProcess.cs:line 122
   at ORTS.Processes.LoaderProcess.DoLoad() in c:\Users\James\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Processes\LoaderProcess.cs:line 103
   at ORTS.Processes.LoaderProcess.LoaderThread() in c:\Users\James\Documents\Coding\Jenkins\jobs\Open Rails\workspace\Source\RunActivity\Processes\LoaderProcess.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()


So i tried the debug mode in VS and i see the TrainReference object is empty, but i think it isn't supposed to be empty.
Attached Image: patherror.jpg

And i've found where the error happens:
Attached Image: patherror2.jpg
...between the station and the exit signal. BUT it happens at same place even if i move the path to other tracks.
I've tried the path in explore mode, and no error happened, nor in a lot of activites that are go through this station. Only happens in timetable mode.

#2 User is offline   engmod 

  • Open Rails Developer
  • PipPipPipPipPipPipPip
  • Group: ET Admin
  • Posts: 1,775
  • Joined: 26-February 08
  • Gender:Male
  • Location:Eltham, Victoria, Australia
  • Simulator:ORNYMG
  • Country:

Posted 16 October 2014 - 03:17 PM

There are already 2 bugs reported for this issue.
One of them talks about paths.

#3 User is offline   disc 

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

Posted 19 October 2014 - 11:22 AM

What i don't understand is there are a lot of activities that have multiple path through these sections, and the problem doesn't appear.

#4 User is offline   roeter 

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

Posted 20 October 2014 - 06:41 AM

In activity mode, any alternative path defined for the player train is also available to any other train (in both directions), in additional to any paths defined for that particular train itself.
In timetable mode, only the alternative paths as defined for that particular train are available.

That could explain the difference between behaviour in activity and timetable mode.

As for this situation : normally, an alternative path must lead back 'by default' to the main path. That does not seem to be the case in the situation above. In the screenshot above, the 'orange' alternative path stops at the first switch and does not lead back to the main 'yellow' path.
Also, from the way the error occurs (with TrainReferences.Count = 0), no alternative paths at all are available for any train. It seems to me that the error does not occur when the program tries to find an alternative path, but during the processing of the alternative paths.
What seems to happen is that an alternative path is defined, and the train is therefor given an entry index in the deadlock definition (this entry index is used as index to find the available paths, it's the "thisTrainAndSubpathIndex" variable in the code above). But somehow this path can not be validated by the processing and therefor is not set up as valid alternative path. Without a valid alternative path, the main path for the train is not inserted either. Because of this, the train should not have been given the entry index in de deadlock definition or, on finding no valid path, this entry index should have been removed.

Regards,
Rob Roeterdink

#5 User is offline   disc 

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

Posted 20 October 2014 - 07:20 AM

That unfinished passing path is not saved, it's just a reused screenshot, originally used to show a problem of trackviewer.
So in saved pat file, there is no alternative path there, only the main.

-that "The given key was not present in the dictionary." error happens mostly on alternative, passing paths(which are return to main path, so didn't seemed to be invalid). This was the first time when i saw this error with main path only section.

-The trackviewer where i made the paths, doesn't even let you to save broken/unfinished paths. I can't try paths that are made in MSTS act editor, as i have windows 8.1 and amd gpu... where it's impossible to make MSTS run.
-In activity, or explore mode i didn't seen such error, even if i use the same path that cause this error in timetable mode
-around that place on screenshot, where the error occurs, there is no any alternative path in 20 km distance.
-if i add alternative paths, there, the error still happens.
-before the last modifications to the path, the game didn't reached this exeption, but freezed at 5:00 in prerun.

Could this happen because of signals?

the error happens with path "TTAF6 Szeged-Nyugati.pat"
If this isn't enought, the route is also freeware(but it's a bit complicated to install), and i can send the timetable too

#6 User is offline   disc 

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

Posted 29 October 2014 - 05:21 AM

So there is no solution to this?

#7 User is offline   disc 

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

Posted 07 November 2014 - 04:55 AM

This is really weird. I've made the two timetables for a line: one with only the intercities, another with the regional passenger trains. Both worked. But if i combine these two timetables, the error above happens, and it happens where only the inter city trains are running, as the regional passenger trains stop, and reverse 50 kms before that point.

And nothing changes if the paths are created with MSTS act editor.

#8 User is offline   disc 

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

Posted 17 November 2014 - 11:59 AM

View Postroeter, on 17 November 2014 - 08:29 AM, said:

We're drifting :) - but never mind.
It's not relevant whether there is another train to pass or not - the only thing which is relevant is if any train has defined an alternative path in that area.
Simplified, what happens is if an alternative path is available at a particular location, no path is allocated to the train at that location but that allocation is postponed until the train reaches that location. Then, the possible paths are checked and the most proper available path is allocated.
In your situation, the error occurs because the system thinks alternative paths are available and so no default path is allocated, but when the train gets to that location no paths are defined at all. I cannot find how this can happen. The problem in finding this error is, ofcourse, that the crash as such is not the actual error - the crash results from incorrect data. The error is how this data became corrupted, but how and when that does happen is still shrouded in mystery. That changing signal settings can influence the crash only deepens that mystery as there is no direct link between signal settings and the path allocation logic.
These signal settings can influence the timing, but this data is assumed to be stable and so should not be affected by timing aspects.

In all - I have no clue as to what goes wrong :wtf01: .

Regards,
Rob Roeterdink


Where the problem randomly happens there are passing paths. But where it's constantly happens there is one path to one direction, and another to the other direction (double track, so each direction have own track). The passing paths are removed in 20 km radius, and no other train goes there.

Attached Image: crash.jpg
Both services come from south on the highlighted path, but the regional service stops where is "2." mark, while the intercity continues to north. If only the ICs are included in timetable, all reach the destination without problem from 05:00 to the last one at 21:00. If i add the regional services and don't touch others, then the first IC crashes where it's marked.

#9 User is offline   roeter 

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

Posted 18 November 2014 - 01:13 AM

And so it keeps getting more mysterious. More and more I get the feeling that this is not a 'normal' program error, but that somehow the data gets corrupted, perhaps by using an incorrect index somewhere. That's going to be hard to find.
I need to work out a series of additional print-out statements to try and capture this one, but that will take some time.

Regards,
Rob Roeterdink

#10 User is offline   disc 

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

Posted 18 November 2014 - 01:33 AM

There are some warnings during the loading, i don't know if those can have connection with such errors.
Attached File  OpenRailsLog.txt (18.31K)
Number of downloads: 173

  • 6 Pages +
  • 1
  • 2
  • 3
  • Last »
  • 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