Jump to content

ArgumentOutOfRangeException: Argument is out of range. Parameter name: index


Recommended Posts

Hi All,

I have the following code in my Update() method in my main KSP plugin class. This code is all there is at the moment, as I'm in the middle of debugging. Yes, I am aware this will create a maneuver node at each frame: bear with me.


Vector3d deltaV = new Vector3d(1.0, 1.0, 1.0);
double ut = Planetarium.GetUniversalTime();
ManeuverNode isUseNode = FlightGlobals.ActiveVessel.patchedConicSolver.AddManeuverNode(ut);
isUseNode.OnGizmoUpdated(deltaV, ut);

When this code executes, my debug log is spammed with loads the following errors:


[EXC 22:49:11.478] ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
[LOG 22:49:11.480] Look rotation viewing vector is zero
[LOG 22:49:11.480] Look rotation viewing vector is zero
[LOG 22:49:11.480] Look rotation viewing vector is zero
[LOG 22:49:11.480] Look rotation viewing vector is zero
[LOG 22:49:11.481] Look rotation viewing vector is zero
[LOG 22:49:11.481] Look rotation viewing vector is zero
[LOG 22:49:11.481] Look rotation viewing vector is zero
[LOG 22:49:11.481] Look rotation viewing vector is zero
[EXC 22:49:11.491] ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
[LOG 22:49:11.492] Look rotation viewing vector is zero
[LOG 22:49:11.493] Look rotation viewing vector is zero
[LOG 22:49:11.493] Look rotation viewing vector is zero
[LOG 22:49:11.493] Look rotation viewing vector is zero
[LOG 22:49:11.493] Look rotation viewing vector is zero
[LOG 22:49:11.494] Look rotation viewing vector is zero
[LOG 22:49:11.494] Look rotation viewing vector is zero
[LOG 22:49:11.494] Look rotation viewing vector is zero
[EXC 22:49:11.502] ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
[LOG 22:49:11.504] Look rotation viewing vector is zero
[LOG 22:49:11.504] Look rotation viewing vector is zero
[LOG 22:49:11.504] Look rotation viewing vector is zero
[LOG 22:49:11.505] Look rotation viewing vector is zero
[LOG 22:49:11.505] Look rotation viewing vector is zero
[LOG 22:49:11.505] Look rotation viewing vector is zero
[LOG 22:49:11.505] Look rotation viewing vector is zero
[LOG 22:49:11.506] Look rotation viewing vector is zero
[EXC 22:49:11.512] ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
[LOG 22:49:11.514] Look rotation viewing vector is zero
[LOG 22:49:11.514] Look rotation viewing vector is zero
[LOG 22:49:11.514] Look rotation viewing vector is zero
[LOG 22:49:11.515] Look rotation viewing vector is zero
[LOG 22:49:11.515] Look rotation viewing vector is zero
[LOG 22:49:11.515] Look rotation viewing vector is zero
[LOG 22:49:11.515] Look rotation viewing vector is zero
[LOG 22:49:11.516] Look rotation viewing vector is zero
[EXC 22:49:11.530] ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
[LOG 22:49:11.531] Look rotation viewing vector is zero
[LOG 22:49:11.531] Look rotation viewing vector is zero
[LOG 22:49:11.532] Look rotation viewing vector is zero
[LOG 22:49:11.532] Look rotation viewing vector is zero
[LOG 22:49:11.532] Look rotation viewing vector is zero
[LOG 22:49:11.532] Look rotation viewing vector is zero
[LOG 22:49:11.533] Look rotation viewing vector is zero
[LOG 22:49:11.533] Look rotation viewing vector is zero
[EXC 22:49:11.546] ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
[LOG 22:49:11.548] Look rotation viewing vector is zero
[LOG 22:49:11.548] Look rotation viewing vector is zero
[LOG 22:49:11.548] Look rotation viewing vector is zero
[LOG 22:49:11.548] Look rotation viewing vector is zero
[LOG 22:49:11.549] Look rotation viewing vector is zero
[LOG 22:49:11.549] Look rotation viewing vector is zero
[LOG 22:49:11.549] Look rotation viewing vector is zero
[LOG 22:49:11.549] Look rotation viewing vector is zero
[EXC 22:49:11.563] ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
[LOG 22:49:11.565] Look rotation viewing vector is zero
[LOG 22:49:11.565] Look rotation viewing vector is zero
[LOG 22:49:11.565] Look rotation viewing vector is zero
[LOG 22:49:11.565] Look rotation viewing vector is zero
[LOG 22:49:11.566] Look rotation viewing vector is zero
[LOG 22:49:11.566] Look rotation viewing vector is zero
[LOG 22:49:11.566] Look rotation viewing vector is zero
[LOG 22:49:11.566] Look rotation viewing vector is zero
[EXC 22:49:11.580] ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
[LOG 22:49:11.581] Look rotation viewing vector is zero
[LOG 22:49:11.581] Look rotation viewing vector is zero
[LOG 22:49:11.582] Look rotation viewing vector is zero
[LOG 22:49:11.582] Look rotation viewing vector is zero
[LOG 22:49:11.582] Look rotation viewing vector is zero
[LOG 22:49:11.582] Look rotation viewing vector is zero
[LOG 22:49:11.582] Look rotation viewing vector is zero
[LOG 22:49:11.583] Look rotation viewing vector is zero
[EXC 22:49:11.596] ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
[LOG 22:49:11.598] Look rotation viewing vector is zero
[LOG 22:49:11.598] Look rotation viewing vector is zero
[LOG 22:49:11.598] Look rotation viewing vector is zero
[LOG 22:49:11.598] Look rotation viewing vector is zero
[LOG 22:49:11.599] Look rotation viewing vector is zero
[LOG 22:49:11.599] Look rotation viewing vector is zero
[LOG 22:49:11.599] Look rotation viewing vector is zero
[LOG 22:49:11.599] Look rotation viewing vector is zero
[EXC 22:49:11.612] ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
[LOG 22:49:11.613] Look rotation viewing vector is zero
[LOG 22:49:11.613] Look rotation viewing vector is zero
[LOG 22:49:11.614] Look rotation viewing vector is zero
[LOG 22:49:11.614] Look rotation viewing vector is zero
[LOG 22:49:11.614] Look rotation viewing vector is zero
[LOG 22:49:11.614] Look rotation viewing vector is zero
[LOG 22:49:11.615] Look rotation viewing vector is zero
[LOG 22:49:11.615] Look rotation viewing vector is zero
[EXC 22:49:11.629] ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
[LOG 22:49:11.631] Look rotation viewing vector is zero
[LOG 22:49:11.631] Look rotation viewing vector is zero
[LOG 22:49:11.631] Look rotation viewing vector is zero
[LOG 22:49:11.632] Look rotation viewing vector is zero
[LOG 22:49:11.632] Look rotation viewing vector is zero
[LOG 22:49:11.632] Look rotation viewing vector is zero
[LOG 22:49:11.632] Look rotation viewing vector is zero
[LOG 22:49:11.633] Look rotation viewing vector is zero
[EXC 22:49:11.646] ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
[LOG 22:49:11.648] Look rotation viewing vector is zero
[LOG 22:49:11.648] Look rotation viewing vector is zero
[LOG 22:49:11.648] Look rotation viewing vector is zero
[LOG 22:49:11.648] Look rotation viewing vector is zero
[LOG 22:49:11.649] Look rotation viewing vector is zero
[LOG 22:49:11.649] Look rotation viewing vector is zero
[LOG 22:49:11.649] Look rotation viewing vector is zero
[LOG 22:49:11.649] Look rotation viewing vector is zero
[EXC 22:49:11.663] ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index

And so on forever. The Exception is being thrown in KSP's code, not in my plugin.

Anyone know what could be causing this? There is literally no other code running in my project except those four lines. Mine you, executing those four lines elsewhere in the project also seems to throw the same errors above, which is the real issue I'm trying to solve. It is very puzzling to say the least. Can someone help?

Thanks!

Link to comment
Share on other sites

Probably this is off-base, but what if you try to place the maneuver node a bit in the future, instead of right at the present? E.g.:

double ut = Planetarium.GetUniversalTime() + 10;

Sadly, no effect. I still get the same error.

Can you look in output_log.txt instead and get the call stack of the exception? It may shed a little more light...

What I posted was from the output log, sadly. There is no stack trace, just what I displayed, over and over again. I wish a developer could see this, because I suspect it's something internal to KSP that's going wrong...

Link to comment
Share on other sites

Are you sure you're looking at the right log? I get similar exception spam if I run your code while the ship is landed:

ArgumentOutOfRangeException: Argument is out of range. Parameter name: index
at System.Collections.Generic.List`1[PatchRendering].get_Item (Int32 index) [0x00000] in <filename unknown>:0
at OrbitTargeter.ReferencePatchSelect () [0x00000] in <filename unknown>:0
at OrbitTargeter.LateUpdate () [0x00000] in <filename unknown>:0

But it works fine in orbit.

You can also enable stack-traces in the Alt+F2 menu with a debug setting in the game's config

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...