EDCD / EDDI

Companion application for Elite Dangerous
Other
444 stars 81 forks source link

`Carrier Jump Engaged` event will crash VoiceAttack when the target is a barycenter instead of an actual body #1972

Closed alterNERDtive closed 3 years ago

alterNERDtive commented 4 years ago

EDDI version in which issue is found

v3.7.0

VoiceAttack version in which issue is found (as applicable)

beta 1.8.6.14

Steps to reproduce

  1. queue a jump into a system and end up orbiting the barycenter of two bodies (I have no idea if you can actually target that, in this case it apparently was the first free spot)
  2. wait until the carrier jumps

Expected

EDDI handles the Carrier Jump Engaged event properly. I think it’s one of the derived ones.

Observed

VA crashes (standalone will probably do that, too?) with an unhandled NullReferenceException.

Investigation

Excerpt of VoiceAttackFault.txt:

08 October 2020***************************************************************************************
Newtonsoft.Json.JsonSerializationException: Error getting value from 'shortname' on 'EddiEvents.CarrierJumpEngagedEvent'. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at EddiEvents.CarrierJumpEngagedEvent.get_shortname()
   at Getshortname(Object )
   at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)
   --- End of inner exception stack trace ---
   at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
   at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
   at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer)
   at EddiCore.EDDI.eventHandler(Event event)
   at EddiCore.EDDI.dequeueEvent()
   at EddiCore.EDDI.<enqueueEvent>b__128_0()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
***VoiceAttack v1.8.6.14 - Windows 10.0.19041.0

(timestamp is missing by accident in 1.8.6.14, fixed in current beta after I reported it)

The CarrierJumpRequest journal event:

{ "timestamp":"2020-10-08T17:39:10Z", "event":"CarrierJumpRequest", "CarrierID":3700289792, "SystemName":"Malannher", "SystemAddress":9467584128417, "BodyID":5 }

The system does not have a body on EDSM with the ID 5 since it’s not listing barycenters as bodies.

alterNERDtive commented 4 years ago

So I don’t see a way to specifically target a barycenter. I guess … have fun trying to reproduce? :D

alterNERDtive commented 4 years ago

One more piece of evidence though; after the carrier was in system already, I tried jumping to the main star. It was full, and it queued another jump to the same destination, basically trying to jump me in place. This time the event in the journal read

{ "timestamp":"2020-10-08T18:22:05Z", "event":"CarrierJumpRequest", "CarrierID":3700289792, "SystemName":"Malannher", "Body":"Malannher 1+2", "SystemAddress":9467584128417, "BodyID":5 }

So apparently it’s also a bug/inconsistency with the game itself. If you

  1. jump to a system you have not been in yet
  2. the system’s main star is out of slots
  3. the next available slot is in a barycenter instead of a body

there will be no body property in the journal event.

Going through my journals it appears that there is a body property if you jump into unvisited systems and actually end up on a body; though all of those cases for me had me jump in on the star and there were no other carriers in the system, so there might be more to it.

I guess the best way to handle it is to not rely on the body property existing in all cases.

Edit: example for unvisited system in the middle of nowhere:

{ "timestamp":"2020-09-23T08:17:48Z", "event":"CarrierJumpRequest", "CarrierID":3702881280, "SystemName":"Keems XS-U d2-0", "Body":"Keems XS-U d2-0 A", "SystemAddress":11735663387, "BodyID":1 }