Dubwise56 / Dubs-Performance-Analyzer

Dubs Performance Analyzer
22 stars 3 forks source link

Failed to capture Harmony ctor: null reference #16

Open Vectorial1024 opened 1 month ago

Vectorial1024 commented 1 month ago

When entering a world with a modlist containing Harmony and some other mods (cannot confirm exact cause yet), an exception is thrown many times, which is likely equal to the number of enabled C# mods:

[Analyzer] Failed to capture Harmony ctor, exception: Object reference not set to an instance of an object, occured at 
Analyzer.Profiling.RememberHarmonyIDs:Prefix(string)

Analyzer.Profiling.ThreadSafeLogger:ReportException(Exception, string)
Analyzer.Profiling.RememberHarmonyIDs:Prefix(string)
HarmonyLib.Harmony:.ctor(string)
      - Prefixes: {  } 

System.Reflection.MonoCMethod:InternalInvoke(object, object[], ref Exception&)
System.Reflection.MonoCMethod:InternalInvoke(object, object[])
System.Reflection.MonoCMethod:DoInvoke(object, BindingFlags, Binder, object[], CultureInfo)
System.Reflection.MonoCMethod:Invoke(BindingFlags, Binder, object[], CultureInfo)
System.RuntimeType:CreateInstanceImpl(BindingFlags, Binder, object[], CultureInfo, object[], ref StackCrawlMark&)
System.Activator:CreateInstance(Type, BindingFlags, Binder, object[], CultureInfo, object[])
System.Activator:CreateInstance(Type, object[])
      - Prefixes: { me.samboycoding.blm } 
Verse.LoadedModManager:CreateModClasses()
Verse.LoadedModManager:LoadAllActiveMods(bool)
Verse.PlayDataLoader:DoPlayLoad()
      - Postfixes: { UnlimitedHugs.HugsLib } 
Verse.PlayDataLoader:LoadAllPlayData(bool)
Verse.Root+<>c:<Start>b__6_1()
Verse.LongEventHandler:RunEventFromAnotherThread(Action)
Verse.LongEventHandler+<>c:<UpdateCurrentAsynchronousEvent>b__28_0()
System.Threading.ThreadHelper:ThreadStart_Context(object)
System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, object, bool)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, object, bool)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, object)
System.Threading.ThreadHelper:ThreadStart()

Some Google search eventually hinted at this mod being the cause of this error, and indeed this mod is using the Analyzer.Profiling namespace.

Detailed investigation may be needed.

sharkman commented 1 month ago

Currently experiencing exactly the same issue, log attached.

[Analyzer] Failed to capture Harmony ctor, exception: Object reference not set to an instance of an object, occured at 
Analyzer.Profiling.RememberHarmonyIDs:Prefix(string)

Analyzer.Profiling.ThreadSafeLogger:ReportException(Exception, string)
Analyzer.Profiling.RememberHarmonyIDs:Prefix(string)
HarmonyLib.Harmony:.ctor(string)
      - Prefixes: {  } 

System.Reflection.MonoCMethod:InternalInvoke(object, object[], ref Exception&)
System.Reflection.MonoCMethod:InternalInvoke(object, object[])
System.Reflection.MonoCMethod:DoInvoke(object, BindingFlags, Binder, object[], CultureInfo)
System.Reflection.MonoCMethod:Invoke(BindingFlags, Binder, object[], CultureInfo)
System.RuntimeType:CreateInstanceImpl(BindingFlags, Binder, object[], CultureInfo, object[], ref StackCrawlMark&)
System.Activator:CreateInstance(Type, BindingFlags, Binder, object[], CultureInfo, object[])
System.Activator:CreateInstance(Type, object[])
Verse.LoadedModManager:CreateModClasses()
Verse.LoadedModManager:LoadAllActiveMods(bool)
Verse.PlayDataLoader:DoPlayLoad()
      - Postfixes: { UnlimitedHugs.HugsLib } 
Verse.PlayDataLoader:LoadAllPlayData(bool)
Verse.Root+<>c:<Start>b__6_1()
Verse.LongEventHandler:RunEventFromAnotherThread(Action)
Verse.LongEventHandler+<>c:<UpdateCurrentAsynchronousEvent>b__28_0()
System.Threading.ThreadHelper:ThreadStart_Context(object)
System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, object, bool)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, object, bool)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, object)
System.Threading.ThreadHelper:ThreadStart()

https://gist.github.com/HugsLibRecordKeeper/a61a4748664861bbd839e31060b03085