View Issue Details

IDProjectCategoryLast Update
0025478AI War 2Crash/ExceptionAug 5, 2021 4:11 pm
ReporterDaniexpert Assigned ToChris_McElligottPark  
Status resolvedResolutionfixed 
Product VersionBeta 3.503 Multiplayer Sound 
Fixed in VersionBeta 3.504 Multiplayer Achievements 
Summary0025478: Error in targeting logic System.NullReferenceException
DescriptionSee attachment
TagsNo tags attached.

Activities

Daniexpert

Aug 5, 2021 9:36 am

manager  

exceptionTargetingLogic.txt (3,732 bytes)   
8/5/2021 3:34:01 PM 3.503 SINGLEP DELAYED4: Error in targeting logic System.NullReferenceException: Object reference not set to an instance of an object
  at Arcen.AIW2.Core.EntitySystem.GetIsTargetValid (Arcen.AIW2.Core.GameEntity_Squad target) [0x00077] in <da12c8ad86e4427c9c029187bdba6942>:0 
  at Arcen.AIW2.External.TargetListPlanning.FindTopEntriesForSystem (Arcen.AIW2.Core.GameEntity_Squad AttackerEntity, Arcen.AIW2.Core.EntitySystem AttackerSystem, Arcen.AIW2.Core.EntitySystemTypeData attackerSystemTypeData, System.Int32 SystemIndex, Arcen.Universal.ArcenCharacterBuffer traceBuffer) [0x00485] in <fbc92d115f3d40dc9fcb12b8381cd65c>:0 
  at Arcen.AIW2.External.TargetListPlanning.DoEntityFramePlanningLogic_TargetPrioritizing_SpecificSystem (Arcen.AIW2.Core.GameEntity_Squad AttackerEntity, Arcen.AIW2.Core.EntitySystem AttackerSystem, System.Int32 SystemIndex, Arcen.Universal.ArcenCharacterBuffer traceBuffer) [0x00018] in <fbc92d115f3d40dc9fcb12b8381cd65c>:0 
  at System.Environment.get_StackTrace () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at Arcen.Universal.ArcenDebugging.ArcenDebugLog (System.String Message, Arcen.Universal.Verbosity Verbosity) [0x00000] in <e6c263c3478540379b40cbd8b3af8103>:0 
  at Arcen.AIW2.External.TargetListPlanning.DoEntityFramePlanningLogic_TargetPrioritizing_SpecificSystem (Arcen.AIW2.Core.GameEntity_Squad AttackerEntity, Arcen.AIW2.Core.EntitySystem AttackerSystem, System.Int32 SystemIndex, Arcen.Universal.ArcenCharacterBuffer traceBuffer) [0x00000] in <fbc92d115f3d40dc9fcb12b8381cd65c>:0 
  at Arcen.AIW2.External.TargetListPlanning.DoEntityFramePlanningLogic_TargetPrioritizing (Arcen.AIW2.Core.GameEntity_Squad AttackerEntity) [0x00000] in <fbc92d115f3d40dc9fcb12b8381cd65c>:0 
  at Arcen.AIW2.Core.EntityCollection.DoForEntities (Arcen.AIW2.Core.GameEntity_Squad+ProcessorDelegate Processor) [0x00000] in <da12c8ad86e4427c9c029187bdba6942>:0 
  at Arcen.AIW2.External.TargetListPlanning.<Execute>b__13_0 (Arcen.AIW2.Core.Planet planet) [0x00000] in <fbc92d115f3d40dc9fcb12b8381cd65c>:0 
  at Arcen.AIW2.Core.Galaxy.DoForPlanetsSingleThread (System.Boolean IncludeDestroyed, Arcen.AIW2.Core.Planet+ProcessorDelegate Processor) [0x00000] in <da12c8ad86e4427c9c029187bdba6942>:0 
  at Arcen.AIW2.Core.World_AIW2.DoForPlanetsSingleThread (System.Boolean IncludeDestroyed, Arcen.AIW2.Core.Planet+ProcessorDelegate Processor) [0x00000] in <da12c8ad86e4427c9c029187bdba6942>:0 
  at Arcen.AIW2.External.TargetListPlanning.Execute () [0x00000] in <fbc92d115f3d40dc9fcb12b8381cd65c>:0 
  at Arcen.AIW2.External.ArcenSimPlanningContext.InnerRun () [0x00000] in <fbc92d115f3d40dc9fcb12b8381cd65c>:0 
  at Arcen.AIW2.External.ArcenThread.InternalActualThreadFunction () [0x00000] in <fbc92d115f3d40dc9fcb12b8381cd65c>:0 
  at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at System.Threading.ThreadHelper.ThreadStart () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0 
exceptionTargetingLogic.txt (3,732 bytes)   

Chris_McElligottPark

Aug 5, 2021 4:11 pm

administrator   ~0062620

Thanks!

* Hardened a bunch of methods in EntitySystem against having cross-threading exceptions.
** The original one with an exception reported was GetIsTargetValid().
** Then also fixed another dozen or so. It's a lot of code!

* After completing the above changes, decided that this was still too free-form and not adhering the principles of encapsulation enough.
** Specifically, there were a lot of places in the code that had to worry about if the ParentEntity, TypeData, or DataForMark of a system were missing or wrong, and would try to fix them.
** This has all been taken internal to EntitySystem itself, and other code is now restricted from trying to fix it. It's also more robust in that it keeps even wrong data until it has new non-null data to replace it, which means that we can't get wrong data from this being in the pool and still accessed by some random piece of distant code.
** This change will require all code-based mods to be recompiled at the very least, and if there were and attempts in there to protect against stuff like DataForMark being null by reassigning it, those reassignment bits need to be taken out.
** To modders: even if your code compiles without complaint, be sure to send in the new dll. We changed a number of direct variables into properties, so your dll will update its references appropriately even if you have no code complaints.
** TLDR: yay less code, and it's more self-maintaining. This was becoming a rabbit warren of ongoing bugs over the last week, so it was time to nip that before it kept going.

* Macrophage Histiocytes, Civilian Industries, and AMU have all already been updated, since I had the code to those in the official repository.

Issue History

Date Modified Username Field Change
Aug 5, 2021 9:36 am Daniexpert New Issue
Aug 5, 2021 9:36 am Daniexpert File Added: exceptionTargetingLogic.txt
Aug 5, 2021 12:14 pm Chris_McElligottPark Assigned To => Chris_McElligottPark
Aug 5, 2021 12:14 pm Chris_McElligottPark Status new => assigned
Aug 5, 2021 4:11 pm Chris_McElligottPark Status assigned => resolved
Aug 5, 2021 4:11 pm Chris_McElligottPark Resolution open => fixed
Aug 5, 2021 4:11 pm Chris_McElligottPark Fixed in Version => Beta 3.504 Multiplayer Achievements
Aug 5, 2021 4:11 pm Chris_McElligottPark Note Added: 0062620