mgoeppner / evemon

A lightweight, easy-to-use standalone Windows application designed to assist you in keeping track of your EVE Online character progression.
https://mgoeppner.github.io/evemon/
GNU General Public License v2.0
162 stars 22 forks source link

XmlGenerator crashes on latest sqldump. #37

Closed wvdvegt closed 2 years ago

wvdvegt commented 2 years ago
Unhandled Exception: System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
   at EVEMon.XmlGenerator.Datafiles.Properties.ExportAttributeCategories() in evemon\tools\XmlGenerator\Datafiles\Properties.cs:line 310
   at EVEMon.XmlGenerator.Datafiles.Properties.GenerateDatafile() in evemon\tools\XmlGenerator\Datafiles\Properties.cs:line 49
   at EVEMon.XmlGenerator.Program.Main() in evemon\tools\XmlGenerator\Program.cs:line 78
wvdvegt commented 2 years ago

Replaced around line 309 in XmlGenerator\Datafiles\Properties.cs:

                    // Unit
                    prop.UnitID = srcProp.UnitID.GetValueOrDefault();
                    prop.Unit = srcProp.UnitID.HasValue
                        ? Database.EveUnitsTable.Concat(s_injectedUnits).First(
                            x => x.ID == srcProp.UnitID.Value).DisplayName
                        : string.Empty;

by

                    // Unit

                    prop.UnitID = srcProp.UnitID.GetValueOrDefault();

                    Database.EveUnitsTable.Concat(s_injectedUnits);

                    prop.Unit = srcProp.UnitID.HasValue && Database.EveUnitsTable.Any(
                            x => x.ID == srcProp.UnitID.Value)
                        ? Database.EveUnitsTable.FirstOrDefault(
                            x => x.ID == srcProp.UnitID.Value).DisplayName
                        : string.Empty;

Seems a unit is missing somewhere in the new mining stuff.

Basically Database.EveUnitsTable.Concat(s_injectedUnits).First(x => x.ID == srcProp.UnitID.Value) returns null causing issues with the DisplayName needed.

mgoeppner commented 2 years ago

commit 964c664bdfe2fa86944b732f8dc3c9d2ebac5098 has a fix which adds the real percent unit

mgoeppner commented 2 years ago

It would probably be a good idea to start pulling in the hoboleaks sde complements to prevent this from happening again. When I fixed the real percent unit, I actually thought it was a bug in the SDE until aurora stated otherwise.

Either that or we should lobby the CSM to convince CCP to include the missing data that hoboleaks datamines in the SDE.

wvdvegt commented 2 years ago

Indeed a better solution but you might consider adding some diagnostic logging at the spot i posted to diagnose missing stuff easier next time (and prevent the app crashing on it).

mgoeppner commented 2 years ago

Sure thing.

Closing this as main works correctly with the latest SDE.