kianzarrin / NodeController

10 stars 9 forks source link

Array index out of range #6

Closed originalfoo closed 4 years ago

originalfoo commented 4 years ago

image

Simulation error: Array index is out of range.
- at NodeController.Util.NetUtil/<GetLanesCoroutine2>d__47.MoveNext () <0x000c5>
at NodeController.UpdateLanes.AllFlagsAreForward (uint16,NetInfo/Direction) <0x00115>
at NodeController.UpdateLanes.Postfix (RoadBaseAI&,uint16) <0x000a3>
- at (wrapper dynamic-method) RoadBaseAI.DMD<DMD<UpdateLanes_Patch2>?1467986688..UpdateLanes_Patch2> (RoadBaseAI,uint16,NetSegment&,bool) <0x0272c>
at NetSegment.UpdateLanes (uint16,bool) <0x00092>
- at (wrapper dynamic-method) NetManager.DMD<DMD<SimulationStepImpl_Patch0>?-2106002304..SimulationStepImpl_Patch0> (NetManager,int) <0x00304>
at SimulationManagerBase`2.SimulationStep (int) <0x0004c>
at NetManager.ISimulationManager.SimulationStep (int) <0x00024>
at SimulationManager.SimulationStep () <0x00693>
at SimulationManager.SimulationThread () <0x0018a>
  [Core]

A feast of logs...

AutoRepair.log

DuplicateAssemblyScanner.log

HideUnconnectedTracks.debug.log

NodeController.log

output_log.txt

RMCrosswalks.debug.log

TMPE.log

Also, something wrong with the xml file:

image

NodeControllerXML.zip

originalfoo commented 4 years ago

BTW, for some reason node controller button does not appear when I open roads menu. Maybe the broken xml? Or maybe it positions based on UI component I hid using Hide It mod?

I'm using local build of TM:PE 11.5.0.

kianzarrin commented 4 years ago

I think I fixed that problem. but haven't uploaded it into steam yet.

kianzarrin commented 4 years ago

the xml file is not in xml format! its in binary format. EDIT: maybe I should just call it config or save or change format? I have higher priority things to consider though.

originalfoo commented 4 years ago

It's possibly the reset button that causes error; I'd used that last time, but just happened again and only thing I'd done was increase a node and then reset it.

NodeController.log output_log.txt TMPE.log

kianzarrin commented 4 years ago

That array index out of range only happens when I want to remove forward flags. wait until I upload the next version or use the master branch build to test this.

kianzarrin commented 4 years ago

Actually its preferable to use the master branch rather than subscribing to the asset. I put the asset there for people who could not be bothered to build.

kianzarrin commented 4 years ago

I uploaded a fix. But I don't understand why it happens in the first place. How can you get more lanes than there is in NetInfo.m_lanes. Something is fishy here that probably influences TMPE.

            for (uint laneID = segmentId.ToSegment().m_lanes;
                laneID != 0 // && idx < n; // if I comment out this code, the exception would be resolved.
                laneID = laneID.ToLane().m_nextLane, idx++)

I will write a test code and ask people to give me log result.

kianzarrin commented 4 years ago

@aubergine10 If you saw a file called NodeController.Strange.log can you please send it to me?

originalfoo commented 4 years ago

How can you get more lanes than there is in NetInfo.m_lanes.

Not sure in my current city as I'm only just starting building it - there are no vehicles or houses even, just miles of train track and a road I'm weaving through the mountains heh.

However, I did notice that lanes can be added to segments at run time. How? As far as I can tell things like transport lines! It seems when you route a bus, for example, the bus route is somehow added as lanes. At least as far as I could tell - I didn't investigate fully, as I was looking for somthing else at the time (https://github.com/CitiesSkylinesMods/TMPE/issues/515) and just noticed the weird disconnect between the netinfo and the stuff on the segment. I thought it weird that the segment contained details about the lanes, per segment. Anyway, that's vague recolleciton heh.

But in my current city I have no idea why any extra lanes would be added - I have no transport lines, no cims, no vehicles, etc.

originalfoo commented 4 years ago

If you saw a file called NodeController.Strange.log can you please send it to me?

Can't find that file, but will send it over if it appears.

kianzarrin commented 4 years ago

Can't find that file, but will send it over if it appears.

The file will appear when instead of the array index out of range error on screen.

I did notice that lanes can be added to segments at run time.

I really hope the extra lanes are added to the end. because otherwise TMPE is getting wrong lane info from the lanes in rare occasions.

originalfoo commented 4 years ago

I assume they get added to the end. Can't remember where I saw it, but analyzing from this should help track it down:

image

originalfoo commented 4 years ago

I'm no longer getting any errors in-game, but there's some stuff in the log file.

NodeController.log

kianzarrin commented 4 years ago

You are not getting the NodeController.Strange.log which means one of the following must be wrong:

EDIT: I do have stack trace in the log but that is different than error as you might have guessed already. This is pre-release testing so I am dumping a lot of info in the log. People with different mods are going to have different stack trace and that is going to help me debug some of the problems and save me some time.

kianzarrin commented 4 years ago

I tested segment with bus lane it does not have extra nodes. I still don't understand why segments could have extra lanes which is unsettling. If the NodeController.Strange.log appeared at any moment please send it to me.

originalfoo commented 4 years ago

I don't have any transport routes at all.