🗲 Crashes 🗲
NullReferenceException
Message: Object reference not set to an instance of an object.
Source: SandBox
GetSuitableSpear - PrepareGuardAgentDataFromGarrison - TakeGuardAgentFromGarrisonTroopList - CreateStandGuardWithSpear
I'm getting this crash whenever I take a settlement with my custom culture and try to go to Lord's hall or dungeon
REASON: Custom culture guards entries in spgenericcharacters.xml (sandbox folder) need to go in spnpcharacters.xml in your mod's folder
Source: TaleWorlds.CampaignSystem
CampaignObjectManager - InitializeCachedData - InitializeOnNewGame - OnInitialize - DoLoadingForGameType
REASON: Settlement bound="Settlement.town_CR4" pointed to the non-existing settlement in settlements.xml
GetHeroesForEffectiveRelation - ApplyInternal - CreateRebelPartyAndClan - StartRebellionEvent - DailyTickSettlement
REASON: ?
BuildWorkshopForHeroAtGameStart - BuildWorkshopsAtGameStart - OnNewGameCreatedPartialFollowUp
REASON: Used non-existant equipment set for NPCCharacter: <EquipmentSet id="npc_gentry_equipment_sturgia"/>
GetBodyProperties - GetCharacterCode - set_Character - set_Troop - PartyCharacterVM - InitializePartyList
REASON: Used non-existant BodyProperty for NPCCharacter
DefaultMapDistanceModel - GetDistance
REASON1: Wrongly assigned Settlement, Kingdom without a settlement. Attach dnSpy, it will show faction.FactionMidSettlement == null. Fix your XML.
REASON2: Problems with Navmesh. Inaccessible settlements. Old/mismatching settlements_distance_cache.bin - fix navmesh, regenerate settlements_distance_cache.bin
Once I loaded Lemmy's map together with mine and got this crash ¯\_(ツ)_/¯
CampaignObjectManager.InitializeCachedData()
REASON: settlements.xml error - I accidently deleted one settlement and village had no bounded castle (crash on settlement.OwnerClan.OnBoundVillageAdded(settlement.Village);). This was on new game start.
DefaultMapDistanceModel - GetDistance - VillageGoodProductionCampaignBehavior - DistributeInitialItemsToTowns - OnNewGameCreatedPartialFollowUp
REASON: it happens when a village is too far away from a city (even if the village belongs to a castle) but there is a script to fix that
SOLUTION: : The problem solved by having to make a town closer to the castle, and raise the trade bound system to 4000 (more info)
SpawnNotablesIfNeeded - NotablesCampaignBehavior - DailyTickSettlement
REASON: Some type of notable is missing for some culture. I was missing RuralNotable
Set in <notable_and_wanderer_templates> in culture XML
CalculateAverageWage - DoLoadingForGameType - DoLoadingForGameManager
REASON: ??? (maybe something related to party templates with non-existant troop IDs, but not confirmed)
CharacterObject - GetSkillValue - DefaultPartyMoraleModel - GetMoraleEffectsFromSkill - GetEffectivePartyMorale
REASON: used not existant troop ID in the <MBPartyTemplate id="villager_CUSTOM_CULTURE_template">
HINT: Check Encyclopedia-Troops if necessary troop is actually in the game.
DefaultPartyWageModel - GetTotalWage - MobileParty - get_TotalWage - get_LimitedPartySize - CalculateGarrisonChangeInternal
REASON: Troop ID used in partyTemplates.xml refers to a non-existing troop ID in the trooptree.
SetInitialValuesFromCharacter - CreateNewHero - CreateSpecialHero - CreateMinorFactionHeroFromTemplate - SpawnMinorFactionHeroes - OnNewGameCreated
REASON: spclans.xslt and custom_spclans.xml were in a separate folder for spclans, but missing empty spclans.xml file
HeroCreator - CreateNewHero - CreateSpecialHero - CreateMinorFactionHeroFromTemplate - SpawnMinorFactionHeroes - OnNewGameCreated
REASON: error in <minor_faction_character_templates>, I used name= instead of id=
HeroCreator - CreateNewHero - FindRandomInternal - CreateNewHero - CreateSpecialHero
REASON: error in XSLT by assigning a culture to a hero
SiegeTowerSpawner - AssignParameters - SpawnerEntityMissionHelper - OnPreInit
On starting the scene.
REASON: name property for siege_tower entity:
ArrangeDestructedMeshes - SetUpScene - AfterStart - FinishMissionLoading
REASON: siege engine can't find which wall segment to attack. Tag is missing. Commented out in xscene:
DestructableComponent - OnInit
The scene was working on L1 Summer/Winter/Sprint, crashing on L1/Fall and on all L2/L3
REASON: entity with DestructableComponent had debris_holder with season_mask="253". Removing the season_mask solved the crash:
BackstoryCampaignBehavior - OnNewGameCreated
REASON: commented out some native hard-coded lord/settlement
Check in BackstoryCampaignBehavior.OnNewGameCreated
Fix with Harmony to skip this native code:
CreateNewHero - CreateSpecialHero - OnNewGameCreatedPartialFollowUp - InitialChildGenerationCampaignBehavior
REASON: Hero present, lord not present, lord used in a clan definition as owner
REASON2: wrong id in <xsl:template match="Settlement[@id='village_EN1_3']/@culture">
DefaultMapDistanceModel - GetDistance - UpdateFriendshipAndEnemies
REASON 1: Lord/hero without a proper clan (clan not created/deleted)
REASON 2: Incorrect load order when launching game, e.g. Lemmy's map was loaded after a mod using it.
Kingdom - OnNewGameCreated - InvokeList - OnNewGameCreated
REASON: Deleted hero/lord, the 'owner' of the Kingdom
CalculateDailyProductionAmount - GetWerehouseCapacity - TickProductions - OnNewGameCreatedPartialFollowUp
REASON: assigned a settlement to non-existant clan
REASON2: error in defining minor_clan, I had label_color="FF7264D16" (one digit too much in the color code)
NameGenerator - CalculateNameScore - SelectNameIndex - GenerateHeroFirstName - CreateSpecialHero - InitialChildGenerationCampaignBehavior - OnNewGameCreatedPartialFollowUp
REASON: Clan's owner was non-existant Lord
DefaultMapDistanceModel - GetClosestSettlementForNavigationMesh - GetDistance - FindNearestSettlement - TryToAssignTradeBoundForVillage - UpdateTradeBounds
REASON: saved a Main_map when game was open, xscene file gone, map gone. Game started with vanilla Main_map with custom settlements.xml
AgingCampaignBehavior - OnHeroComesOfAge - InvokeList - DailyTickHero
REASON: error/missing sandboxcore_equipment_sets.xml for the hero's culture. Hero turned 18
Source: MonoMod.Utils
GauntletMovie - LoadMovie_Patch0 - Load - LoadMovie
REASON: Movie XML file not present. (deleted/wrong name/path?)
LordConversationsCampaignBehavior - conversation_wanderer_introduction_on_condition - RunCondition
REASON: No native settlement town_ES4 in the game.
TournamentGames - TournamentMatch - AddParticipant - TournamentBehavior - FillParticipants
REASON: RBM Tournament expects local culture troops in the settlement for the Tournament. Troops were not implemented for that culture.
ArgumentNullException
Message: Value cannot be null. Parameter name: source
Source: System.Core
CreateHeroAtOccupation
REASON: in CUSTOM_culture.xml commented out one name:
also commented out one basic_mercenary_troops:SortedList.Add - AiVisitSettlementBehavior - FindSettlementsToVisitWithDistances - AiHourlyTick
An entry with the same key already exists
REASON: had <Village> with the same id in the settlements.xml
Linq.Enumerable.Any - Extensions.IsEmpty - NameGenerator - GetNameListForCulture - GenerateHeroFirstName
REASON: error in the culture xml file
InvalidOperationException
Message: The XmlReader state should be Interactive.
Source: System.Xml.Linq
ReadContentFrom - Load - ToXDocument - MergeTwoXmls - CreateMergedXmlFile
REASON: error in the XML file, example:
- missing opening tag <Items>
- wrong closing tag <Items/> vs </Items>
- CUSTOM_settlements.xml completely empty
- etc
Message: Sequence contains no matching element
Source: System.Core
Enumerable.First - InitializeCaravanOnCreation - CreateCaravanParty - CreateParty - CreateCaravanParty
REASON: CUSTOM_culture notable Merchant was expecting CaravanGuard with the same culture: character.Culture == mobileParty.Party.Owner.Culture
Single - CharacterCreationCultureStageVM - SortCultureList - CharacterCreationCultureStageView
REASON: Native culture is removed or is made is_main_culture=true
IndexOutOfRangeException
Message: Index was outside the bounds of the array.
Source: TaleWorlds.CampaignSystem
DefaultMapWeatherModel - GetWeatherEventInPosition - WeatherAudioTick - TickVisuals
REASON: Marked 'Use Dynamic Weather Effects' without the a flowmap. Maybe map is not a square. Maybe flowmap is not 1024x1024.
Source: TaleWorlds.CampaignSystem
OnNewGameCreated
REASON1: Lord (NPCCharacter) id mismatch with hero id, no lord for the heroe, "Hero." missed with hero id
REASON2: 2 lords with the same id
REASON3: Comments in spkingdoms.xml :D
REASON4: NPCCharacter age="9.9" (not int) in lords.xml
AccessViolationException
Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source: TaleWorlds.MountAndBlade
MapScene - GetNavigationMeshCenterPosition - DefaultMapDistanceModel - GetClosestSettlementForNavigationMesh - GetDistance - CalculatePartyInfluenceCost - CalculateTotalInfluenceCost
REASON: CUSTOM_settlements.xml does not match settlements.xml
FinalizeMission - EndMissionInternal - CheckMissionEnd - OnTick
Crash was on the exit out from the mission.
REASON: xscene contained one entity, and commenting it out stopped the crash, no idea why/how, there are more similar entities in the scene:
<game_entity name="aserai_grandbazaar_wall" old_prefab_name="" occlusion_body_name="bo_occ_aserai_grandbazaar_wall">
<transform position="-73.488, 137.875, 0.924" rotation_euler="0.000, 0.000, 1.571" scale="0.470, 0.150, 0.000"/>
<physics shape="bo_aserai_grandbazaar_wall"/>
<components>
<meta_mesh_component name="aserai_grandbazaar_wall">
<mesh name="aserai_grandbazaar_wall" material="adobe_wall_white"/>
</meta_mesh_component>
</components>
</game_entity>
Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
InvokeMethod - Invoke - CreateInstanceImpl - CreateInstance - CreateScreen
REASON: map xscene settlement ID mismatch with settlements.xml settlement ID. settlements.xml has a settlement with ID, which is not present in the xscene file
... GetEncyclopediaPageInstance - SetEncyclopediaPage - GauntletMapEncyclopediaView - ExecuteLink
Crash by pressing on the lord's image in the Encyclopedia.
REASON: Lord's spause is deleted, but reference to it in the heroes.xml remains for the main lord. Eg: spouse="Hero.lord_4_2"
TypeInitializationException
Source: TaleWorlds.CampaignSystem
CalculateBaseSpeed - CalculateSpeedForPartyUnified
More info here
System.Xml.Xsl.XslTransformException
Message: Attribute and namespace nodes cannot be added to the parent element after a text, comment, pi, or sub-element node has already been added.
Source: System.Data.SqlXml
XmlQueryOutput - ThrowInvalidStateError
REASON: tried to change non-existant attribute with XSLT
Message: Unexpected token '=' in the expression.
XslCompiledTransform - LoadInternal - ApplyXslt - CreateMergedXmlFile - GetMergedXmlForManaged - LoadXML - InitializeSandboxXMLs
REASON: Translation line in the xslt, like {=skalvians}Skalvians. Move this to XML
CTD without any message
On mission start.
Error log last line: Selected formations being cleared.
REASON: this entity was commented out in the xscene:
When entering settlement.
REASON: Bad troop id: villager_danish vs danish_villager
Others
GetBodyProperties - LocationCharacter - CreateMercenary - AddLocationCharacters - AddMercenaryCharacterToTavern
In CUSTOM_culture.xml error in defining caravan guards:
HarmonyLib.PatchClassProcessor.ReportException() - Patch()
When loading the game with DnSpy attached, make sure to disable the BannerColorPersistence in the load order.