View Issue Details

IDProjectCategoryLast Update
0027003AI War 2Crash/ExceptionApr 19, 2022 12:07 pm
ReporterStrategic Sage Assigned ToChris_McElligottPark  
Status resolvedResolutionfixed 
Product Version4.021 Scourge Of A Beacon 
Fixed in Version4.024 Graveyard Digger 
Summary0027003: Hot-swapping Mods/Expansions Error
DescriptionTo load a save, I needed to load one mod and the first two expansions. The following error log resulted after that completed. I find in these situations that I can consistently load with no problems if I exit the game after swapping and restart the program.

TagsNo tags attached.

Relationships

related to 0026984 resolvedChris_McElligottPark Errors when creating games with only NA expansion active 

Activities

Strategic Sage

Apr 16, 2022 11:03 pm

reporter  

ArcenDebugLog.txt (2,372,208 bytes)

Chris_McElligottPark

Apr 19, 2022 12:06 pm

administrator   ~0066139

Thanks!

* Fixed a subtle reflection-based bug that happened with trying to load the external data links after you changed your mod and expansion statuses around.
** The most notable extant example of this was having a necromancer faction selected in the lobby, and then disabling some DLCs but leaving DLC3 on. However, there were a variety of other ways this could be hit, as this was a generalized issue. It was just subtle enough that it was hard to bring out any other fashion.
** The core of this issue is actually a very interesting computer science situation. Essentially, it went like this:
*** Class ExternalInfo has a variable CachedExternalType on it, and a Pool that uses "this.CachedExternalType" inside an anonymous method to generate members of the pool.
*** After reload of the xml and thus also reset of ExternalInfo, the following things would be true:
**** CachedExternalType was not null in the outer method, and in fact was reset just perfectly.
**** Inside the anonymous method, it "this.CachedExternalType" would be null, presumably because it had been JIT compiled to point to a specific reference that no longer exists. This is one of those places where the intent of reflection and anonymous methods can get a bit lost.
*** Years ago, Keith and I had found the general solution to this is to declare a local working variable copy of the member variable, and have the anonymous method simply refer to the cached local copy. This tends to solve a number of issues, but in general ensures that the anonymous method always has the latest copy of whatever is going on in its specific local context.
**** It's actually possible that this is not a reflection issue, but an order of operation threading issue, although I doubt it. Experiments could be run, if we wanted to figure out the exact cause; or we could look at the JIT results. But really, diving that deep serves no particular purpose at this point. The solution is simply to remember to use local cached copies, regardless, and this is a case where I did not.
** Anyhow, this seems to solve the reported problems, and may solve some other unrelated problems after doing an xml reload, as well.

Issue History

Date Modified Username Field Change
Apr 16, 2022 11:03 pm Strategic Sage New Issue
Apr 16, 2022 11:03 pm Strategic Sage File Added: ArcenDebugLog.txt
Apr 18, 2022 9:42 pm Chris_McElligottPark Sticky Issue No => Yes
Apr 18, 2022 9:43 pm Chris_McElligottPark Relationship added related to 0026984
Apr 18, 2022 9:43 pm Chris_McElligottPark Assigned To => Chris_McElligottPark
Apr 18, 2022 9:43 pm Chris_McElligottPark Status new => assigned
Apr 19, 2022 12:06 pm Chris_McElligottPark Status assigned => resolved
Apr 19, 2022 12:06 pm Chris_McElligottPark Resolution open => fixed
Apr 19, 2022 12:06 pm Chris_McElligottPark Fixed in Version => 4.024 Graveyard Digger
Apr 19, 2022 12:06 pm Chris_McElligottPark Note Added: 0066139
Apr 19, 2022 12:07 pm Chris_McElligottPark Sticky Issue Yes => No