"Elevation Graph" throws exception

Hello.

[1] Problem :

When I try to open “Elevation Graph” from the Planner “Map tools”, Mission Planner Shows below error message :

System.ArgumentException : Must specify valid information for parsing in the string

[2] Environment

  • OS : Windows 11
  • Mission Planner : 1.3.83, build 1.3.9384.38258
  • Stock Mission Planner(All my custom plugins removed.)
  • Own-built Mission Planner showed same result, but on other laptop, “Elevation Graph” worked well.

[3] What I tried

I build Mission Planner in Debug mode,

on above function, at this line,

Enum.Parse(typeof(altmode), CMB_altmode.Text)
  • I Found that “CMB_altmode.Text” prints as blank.
  • This happens even though the combo box is displayed correctly values like Relative, Absolute, Terrain.
  • Clicking the combo box and selecting a different option didn’t change the result.

So, I edited the code like below and the function started to work without error :

        public void elevationGraphToolStripMenuItem_Click(object sender, EventArgs e)
        {
            writeKML();
            double homealt = MainV2.comPort.MAV.cs.HomeAlt;
            // Console.WriteLine($"CMB_altmode.Text : {CMB_altmode.Text}");

            var kv = (KeyValuePair<int, string>)CMB_altmode.SelectedItem;
            altmode mode = (altmode)kv.Key;

            Form temp = new ElevationProfile(pointlist, homealt, mode);
            ThemeManager.ApplyThemeTo(temp);
            temp.ShowDialog();
        }

[4] Questions :

  • Could someone explain why this error occurs?
  • Is My Approach(.Text → KeyValuePair) correct? I’m not familiar with github and I don’t know whether if this is acceptable fix for a pull request.

I tried to reproduce the issue on another laptop using the same Mission Planner version, but I couldn’t identify the cause.

I also applied the same theme to the Mission Planner and tried to find any differences, but without success.


Elevation reference field shoud not be empty…
Normally this should not happen, only if you deliberately cleared the actual content of the field, or config.xml contains an empty value for <CMB_altmode> key.

1 Like

Thank you very much, that was exactly the problem.

It turned out that when I use my old config.xml, the elevation reference field stays empty. I initially thought it only stored basic UI settings, but it seems my config.xml became corrupted over time, likely due to various accumulated data such as custom input boxes from my custom plugins, custom map addresses, and my waypoints.

I’m not entirely sure how it happened, but something definitely went wrong within the config file. Resetting it fixed the issue. Thanks again for the help!