(Solved) Errors for texture loading caused by exception while patching for A18

Started by Albion, October 31, 2017, 09:31:24 AM

Previous topic - Next topic

Albion

Hey guys. I'm having some issues while trying to patch my mod from A17 to unstable A18. I worked through any other error so far but now I ran into a wall and can't figure out what is the issue.
Quick log of the current errors:
First one is yellow:
Caught exception while loading play data but there are active mods other than Core. Resetting mods config and trying again.
The exception was: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Operation is not valid due to the current state of the object
  at System.Linq.Enumerable.Iterate[ThingDef,Single] (IEnumerable`1 source, Single initValue, System.Func`3 selector) [0x00000] in <filename unknown>:0
  at System.Linq.Enumerable.Min[ThingDef] (IEnumerable`1 source, System.Func`2 selector) [0x00000] in <filename unknown>:0
  at Verse.PawnKindDef+<ConfigErrors>c__Iterator0.MoveNext () [0x0024b] in C:\Dev\RimWorld\Assets\Scripts\Verse\Defs\DefTypes\PawnKindDef.cs:295
  at Verse.DefDatabase`1[Verse.PawnKindDef].ErrorCheckAllDefs () [0x0006a] in C:\Dev\RimWorld\Assets\Scripts\Verse\Defs\Databases\DefDatabase.cs:138
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d0] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000eb] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115
  at Verse.GenGeneric.InvokeStaticMethodOnGenericType (System.Type genericBase, System.Type genericParam, System.String methodName) [0x00004] in C:\Dev\RimWorld\Assets\Scripts\Verse\Utility\Gen\GenGeneric.cs:39
  at Verse.PlayDataLoader.DoPlayLoad () [0x0030f] in C:\Dev\RimWorld\Assets\Scripts\Verse\Defs\Databases\PlayDataLoader.cs:217
  at Verse.PlayDataLoader.LoadAllPlayData (Boolean recovering) [0x00026] in C:\Dev\RimWorld\Assets\Scripts\Verse\Defs\Databases\PlayDataLoader.cs:32
Verse.Log:Warning(String) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Utility\Debug\Log\Log.cs:36)
Verse.PlayDataLoader:LoadAllPlayData(Boolean) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Defs\Databases\PlayDataLoader.cs:52)
Verse.Root:<Start>m__1() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\Root\Root.cs:51)
Verse.LongEventHandler:RunEventFromAnotherThread(Action) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:453)
Verse.LongEventHandler:<UpdateCurrentAsynchronousEvent>m__1() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:367)

I'm not exactly sure what this message is telling me but since the next line is: Successfully recovered from errors and loaded play data. I decided to ignore it for now.
However after this there is basically a long list of errors telling me that various textures are unable to load.
My main question is: Is anyone aware of any changes to the way textures get loaded while transitioning to A18? All textures were loading fine in A17 and I didn't make any changes to them while patching to unstable A18. I triple checked capitalization and correct spelling but can't find any mistakes.
For reference here are some of the errors I got:
Could not load UnityEngine.Texture2D at Things/Building/ComputerCoreSW in any active mod or in base resources.
Verse.Log:Error(String) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Utility\Debug\Log\Log.cs:48)
Verse.ContentFinder`1:Get(String, Boolean) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Mods\ContentFinder.cs:46)
Verse.Graphic_Single:Init(GraphicRequest) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Thing\Graphic\Graphic_Single.cs:43)
Verse.GraphicDatabase:GetInner(GraphicRequest) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Thing\Graphic\GraphicDatabase.cs:161)
Verse.GraphicDatabase:Get(Type, String, Shader, Vector2, Color, Color, GraphicData) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Thing\Graphic\GraphicDatabase.cs:134)
Verse.GraphicData:Init() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Defs\DefTypes\DefParts\GraphicData.cs:134)
Verse.GraphicData:get_Graphic() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Defs\DefTypes\DefParts\GraphicData.cs:88)
Verse.ThingDef:<PostLoad>m__3() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Defs\DefTypes\ThingDef.cs:662)
Verse.LongEventHandler:ExecuteToExecuteWhenFinished() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:487)
Verse.LongEventHandler:UpdateCurrentAsynchronousEvent() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:402)
Verse.LongEventHandler:LongEventsUpdate(Boolean&) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:257)
Verse.Root:Update() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\Root\Root.cs:98)
Verse.Root_Entry:Update() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\Root\Root_Entry.cs:25)

MatFrom with null sourceTex.
Verse.Log:Error(String) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Utility\Debug\Log\Log.cs:48)
Verse.MaterialPool:MatFrom(MaterialRequest) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Resources\MaterialPool.cs:83)
Verse.Graphic_Single:Init(GraphicRequest) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Thing\Graphic\Graphic_Single.cs:51)
Verse.GraphicDatabase:GetInner(GraphicRequest) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Thing\Graphic\GraphicDatabase.cs:161)
Verse.GraphicDatabase:Get(Type, String, Shader, Vector2, Color, Color, GraphicData) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Thing\Graphic\GraphicDatabase.cs:134)
Verse.GraphicData:Init() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Defs\DefTypes\DefParts\GraphicData.cs:134)
Verse.GraphicData:get_Graphic() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Defs\DefTypes\DefParts\GraphicData.cs:88)
Verse.ThingDef:<PostLoad>m__3() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Defs\DefTypes\ThingDef.cs:662)
Verse.LongEventHandler:ExecuteToExecuteWhenFinished() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:487)
Verse.LongEventHandler:UpdateCurrentAsynchronousEvent() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:402)

Failed to find any texture while constructing Multi(initPath=Things/Building/MatterweaverSW, color=RGBA(1.000, 1.000, 1.000, 1.000), colorTwo=RGBA(1.000, 1.000, 1.000, 1.000))
Verse.Log:Error(String) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Utility\Debug\Log\Log.cs:48)
Verse.Graphic_Multi:Init(GraphicRequest) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Thing\Graphic\Graphic_Multi.cs:60)
Verse.GraphicDatabase:GetInner(GraphicRequest) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Thing\Graphic\GraphicDatabase.cs:161)
Verse.GraphicDatabase:Get(Type, String, Shader, Vector2, Color, Color, GraphicData) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Thing\Graphic\GraphicDatabase.cs:136)
Verse.GraphicData:Init() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Defs\DefTypes\DefParts\GraphicData.cs:134)
Verse.GraphicData:get_Graphic() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Defs\DefTypes\DefParts\GraphicData.cs:88)
Verse.ThingDef:<PostLoad>m__3() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Defs\DefTypes\ThingDef.cs:662)
Verse.LongEventHandler:ExecuteToExecuteWhenFinished() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:487)
Verse.LongEventHandler:UpdateCurrentAsynchronousEvent() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:402)
Verse.LongEventHandler:LongEventsUpdate(Boolean&) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:257)
Verse.Root:Update() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\Root\Root.cs:98)
Verse.Root_Entry:Update() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\Root\Root_Entry.cs:25)


Any ideas what's the root of these errors?

EDIT: Problem solved. The issue was the exception. Resolving the exception also caused all textures to load properly.
The reason for the exception: The melee weapon tags were changed for A18 so the old one I was still using caused the issue.

CannibarRechter

>  Is anyone aware of any changes to the way textures get loaded while transitioning to A18?

I'm only aware of one such change, that should not apply here. There was a bugfix so that mod textures now load from last mod to first mod (it was previously incorrectly loading first to last, but mods lower in the mod order are supposed to win).

Regarding your first exception (the Linq error), does your mod use C#?

Regarding your last exception, the Multi, is "Things/Building/MatterweaverSW" is this 3 files in Things/Building/, or 3 files in /Things/Building/MatterWeaverSW/?
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

Albion

I don't use any C# code in my mod.

Regarding the Multi I have 3 files in Things/Building/ labeled MatterweaverSW_back.png, ..._front.png and ..._side.png
The path in the .xml file is: <texPath>Things/Building/MatterweaverSW</texPath>

kaptain_kavern

Then I think you need to have them all in a folder called  Things/Building/MatterweaverSW

Albion

Quote from: kaptain_kavern on October 31, 2017, 11:21:54 AM
Then I think you need to have them all in a folder called  Things/Building/MatterweaverSW
Well I tried and I got exactly the same errors. Having different textures in the same folder never was an issue in the past and it seems it's still okay. The problem seems to be caused by something else.

Does also anyone have any idea about the first exception? There seems to be some issue with PawnKindDef but I don't get exactly what the problem is.

swefan

I just tried to patch my mods to the unstable A18 and even me get a lots of errors... and my mods aren't so complex, I immagine how difficult will be patching some complex mods  :-\

Albion

Quote from: swefan on October 31, 2017, 12:51:44 PM
I just tried to patch my mods to the unstable A18 and even me get a lots of errors... and my mods aren't so complex, I immagine how difficult will be patching some complex mods  :-\
About 90% of the errors I got where due to the xml tags being case sensitive now and the outer tags being changed to "Defs" instead of "BuildingDefs" or whatever. Also some other attributes were changed, removed or renamed.
I fixed every single one but now I'm stuck with these damn texture errors and have no idea how to fix them.

CannibarRechter

> Then I think you need to have them all in a folder called  Things/Building/MatterweaverSW

That's not how Multis in A17 work, no. I'll confirm his configuration correct for A17, and therefore this is a mystery. I would have to get the A18 Graphic_Multi.cs code to confirm, but I can confirm right now (I'm looking at Graphic_Multi.cs) for A17 that he is right.

Regarding the LINQ error, it shouldn't be possible for XML to cause this kind of error, so that one is an A18 bug of one form or another.
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

Albion

Turns out the textures where all fine...
The problem was actually somehow caused by my PawnKindDef xml file since removing it removed the yellow exception and all the other errors.
I'll have to investigate further and check out what was causing the exception and will keep you up to date on the progress.

Albion

Two hours of testing and finally I found the problem:
The weaponTags for melee weapons got changed resulting in an exception for the weaponsTag I had in a pawnKindDef.
Changing this to the new weaponTags resolved the issue and any and all errors there were.
I'm posting this so if someone else runs into this problem they might find a solution more quickly