Mehni / kNumbers

Quick comparison of colonist stats
MIT License
34 stars 28 forks source link

incompatible with weaponstab #30

Closed inikishev closed 3 years ago

inikishev commented 3 years ago

I saw this in log

System.TypeInitializationException: The type initializer for 'Numbers.StaticConstructorOnGameStart' threw an exception. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: type
  at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00003] in <567df3e0919241ba98db88bec4c6696f>:0 
  at System.Activator.CreateInstance (System.Type type) [0x00000] in <567df3e0919241ba98db88bec4c6696f>:0 
  at RimWorld.PawnColumnDef.get_Worker () [0x00008] in <c36f9493c9844ddaa7fb5c788416098f>:0 
  at Numbers.StaticConstructorOnGameStart+<>c.<AddTrainablesToAnimalTable>b__21_0 (RimWorld.PawnColumnDef x) [0x00000] in <87052afb44fa40d281208d2dc8848ab6>:0 
  at System.Linq.Enumerable+WhereListIterator`1[TSource].MoveNext () [0x00037] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 
  at Numbers.StaticConstructorOnGameStart.AddTrainablesToAnimalTable () [0x00076] in <87052afb44fa40d281208d2dc8848ab6>:0 
  at Numbers.StaticConstructorOnGameStart..cctor () [0x00102] in <87052afb44fa40d281208d2dc8848ab6>:0 
   --- End of inner exception stack trace ---
  at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
  at Numbers.WorldComponent_Numbers.NotifySettingsChanged () [0x0000b] in <87052afb44fa40d281208d2dc8848ab6>:0 
  at Numbers.WorldComponent_Numbers.FinalizeInit () [0x000c4] in <87052afb44fa40d281208d2dc8848ab6>:0 
  at RimWorld.Planet.WorldComponentUtility.FinalizeInit (RimWorld.Planet.World world) [0x00013] in <c36f9493c9844ddaa7fb5c788416098f>:0 

https://gist.github.com/idkman2021/4e1ecc3a5701859e7b137ec67203a729

image

also presets are not loading. I didn't have numbers in my save and now I added it and it doesnt work also I added another mod WeaponsTab and it also doesn't work the tab doesn't open

EDIT I disabled weaponstab and this numbers works now and no error so it is incompatible with weaponstab

Mehni commented 3 years ago

That's an impressive error. Seems like weaponstab triggers it though. From your log:

Exception loading from System.Xml.XmlElement: System.MissingMethodException: Default constructor not found for type Verse.AI.ThinkNode
  at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x0007b] in <567df3e0919241ba98db88bec4c6696f>:0 
  at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00009] in <567df3e0919241ba98db88bec4c6696f>:0 
  at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00027] in <567df3e0919241ba98db88bec4c6696f>:0 
  at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00020] in <567df3e0919241ba98db88bec4c6696f>:0 
  at System.Activator.CreateInstance (System.Type type) [0x00000] in <567df3e0919241ba98db88bec4c6696f>:0 
  at Verse.DirectXmlToObject.ObjectFromXml[T] (System.Xml.XmlNode xmlRoot, System.Boolean doPostLoad) [0x0051d] in <c36f9493c9844ddaa7fb5c788416098f>:0 
  at Verse.DirectXmlToObject.ObjectFromXmlReflection[T] (System.Xml.XmlNode xmlRoot, System.Boolean doPostLoad) [0x00000] in <c36f9493c9844ddaa7fb5c788416098f>:0 
  at Verse.DirectXmlToObject.ObjectFromXml[T] (System.Xml.XmlNode xmlRoot, System.Boolean doPostLoad) [0x0091e] in <c36f9493c9844ddaa7fb5c788416098f>:0 

WeaponsTab has an issue with some thinknode, and the resulting error puts the reflection stack in an unstable state or something.

at RimWorld.PawnColumnDef.get_Worker

=>


public class PawnColumnDef : Def
{
    public Type workerClass = typeof(PawnColumnWorker);

    public PawnColumnWorker Worker
    {
        get
        {
            if (workerInt == null)
            {
                workerInt = (PawnColumnWorker)Activator.CreateInstance(workerClass);
                workerInt.def = this;
            }
            return workerInt;
        }
    }
}

There's no way for workerClass to be null, unless something is really borked. I can't fix that, and I don't really want to write a bunch of error handling code for such a wonky error.

I'm grateful for the report, and now I'm going to close this as won't fix.

inikishev commented 3 years ago

it was weaponstab, it was also incompatible with the other weapons tab mod, broke it in the same way