Zetrith / Prepatcher

Structured assembly rewriting library/mod for RW
MIT License
74 stars 7 forks source link

Prepatcher Error: Exception while reloading: System.NullReferenceException: Settings refonly on a null assembly #10

Closed masakitenchi closed 1 year ago

masakitenchi commented 1 year ago

Workshop version. I have no idea why this still occurs with this load order: image

Mono path[0] = 'D:/SteamLibrary/steamapps/common/RimWorld/RimWorldWin64_Data/Managed'
Mono config path = 'D:/SteamLibrary/steamapps/common/RimWorld/MonoBleedingEdge/etc'
Initialize engine version: 2019.4.30f1 (e8c891080a1f)
[Subsystems] Discovering subsystems at path D:/SteamLibrary/steamapps/common/RimWorld/RimWorldWin64_Data/UnitySubsystems
GfxDevice: creating device client; threaded=1
Direct3D:
    Version:  Direct3D 11.0 [level 11.1]
    Renderer: NVIDIA GeForce RTX 3070 (ID=0x2484)
    Vendor:   
    VRAM:     8032 MB
    Driver:   31.0.15.2833
Begin MonoManager ReloadAssembly
- Completed reload, in  0.059 seconds
<RI> Initializing input.

<RI> Input initialized.

<RI> Initialized touch support.

UnloadTime: 0.881200 ms
Command line arguments: -savedatafolder=C:\Users\fucon\AppData\LocalLow\Ludeon Studios\RimWorld by Ludeon Studios
RimWorld 1.4.3641 rev649
Save data folder overridden to C:\Users\fucon\AppData\LocalLow\Ludeon Studios\RimWorld by Ludeon Studios
Parsed 2287142613 as int. 
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 39)

Mod Vile's Mods_zh dependency (vitech.metallurgy) needs to have <downloadUrl> and/or <steamWorkshopUrl> specified. 
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 39)

Mod  is missing supported versions list in About.xml! (example: <supportedVersions><li>1.0</li></supportedVersions>) 
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 39)

Mod VP_SK_Fences and Floors is missing packageId in About.xml! (example: <packageId>AuthorName.ModName.Specific</packageId>) 
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 39)

Parsed 2287142613 as int. 
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 39)

Mod Hooded Helms addon for Medieval Overhaul dependency (DankPyon.Medieval.Overhaul) needs to have <downloadUrl> and/or <steamWorkshopUrl> specified. 
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 39)

Mod Medieval Medicines 1.4 Medieval Overhaul Edition dependency (DankPyon.Medieval.Overhaul) needs to have <downloadUrl> and/or <steamWorkshopUrl> specified. 
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 39)

Mod Medieval Medicines 1.4 Medieval Overhaul Edition 简体中文汉化 dependency (JoeDaly.MedMeds.MO) needs to have <downloadUrl> and/or <steamWorkshopUrl> specified. 
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 39)

Fallback handler could not load library D:/SteamLibrary/steamapps/common/RimWorld/RimWorldWin64_Data/Mono/data-000001D9B09A2E10.dll
Fallback handler could not load library D:/SteamLibrary/steamapps/common/RimWorld/RimWorldWin64_Data/Mono/data-000001D9B0E7A760.dll
Fallback handler could not load library D:/SteamLibrary/steamapps/common/RimWorld/RimWorldWin64_Data/Mono/data-000001D98E7E6070.dll
Fallback handler could not load library D:/SteamLibrary/steamapps/common/RimWorld/RimWorldWin64_Data/Mono/data-000001D9B0DF6020.dll
Fallback handler could not load library D:/SteamLibrary/steamapps/common/RimWorld/RimWorldWin64_Data/Mono/data-000001D9B0E09440.dll
Fallback handler could not load library D:/SteamLibrary/steamapps/common/RimWorld/RimWorldWin64_Data/Mono/data-000001D9B1271030.dll
Fallback handler could not load library D:/SteamLibrary/steamapps/common/RimWorld/RimWorldWin64_Data/Mono/data-000001D9B13DC070.dll
Prepatcher: Starting...
Tried to use an uninitialized DefOf of type KeyBindingDefOf. DefOfs are initialized right after all defs all loaded. Uninitialized DefOfs will return only nulls. (hint: don't use DefOfs as default field values in Defs, try to resolve them in ResolveReferences() instead) 
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 39)

Tried to use an uninitialized DefOf of type SoundDefOf. DefOfs are initialized right after all defs all loaded. Uninitialized DefOfs will return only nulls. (hint: don't use DefOfs as default field values in Defs, try to resolve them in ResolveReferences() instead) 
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 39)

Prepatcher: Serializing patched assemblies
Prepatcher: Serializing took 123.379
Prepatcher: Setting refonly
Prepatcher: Game processing took 247.3852
Prepatcher Error: Exception while reloading: System.NullReferenceException: Settings refonly on a null assembly
  at Prepatcher.UnsafeAssembly.SetReflectionOnly (System.Reflection.Assembly asm, System.Boolean value) [0x00017] in <e65c8078bf8f44c6b3a977210cc071cf>:0 
  at Prepatcher.Process.ModifiableAssembly.SetSourceRefOnly () [0x0001b] in <e65c8078bf8f44c6b3a977210cc071cf>:0 
  at Prepatcher.Process.Reloader.Reload (Prepatcher.Process.AssemblySet set, System.Action`1[T] loadAssemblyAction) [0x000b8] in <e65c8078bf8f44c6b3a977210cc071cf>:0 
  at Prepatcher.Process.GameProcessing.Process () [0x00141] in <e65c8078bf8f44c6b3a977210cc071cf>:0 
  at Prepatcher.Loader.Reload () [0x0009d] in <e65c8078bf8f44c6b3a977210cc071cf>:0  
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 39)

These are the only information I could provide for now. If you have other that should be known, pls let me know.

P.S. Tried github release, getting this error instead:

Exception from asynchronous event: System.Reflection.TargetException: Non-static field requires a target
  at System.Reflection.MonoField.GetValue (System.Object obj) [0x0000b] in <eae584ce26bc40229c1b1aa476bfa589>:0 
  at Prepatcher.UnsafeAssembly.SetReflectionOnly (System.Reflection.Assembly asm, System.Boolean value) [0x0000d] in <441f9d8d5faa47f8a553c27f47daee0c>:0 
  at Prepatcher.Process.ModifiableAssembly.SetSourceRefOnly () [0x00006] in <441f9d8d5faa47f8a553c27f47daee0c>:0 
  at Prepatcher.Process.Reloader.Reload (Prepatcher.Process.AssemblySet set, System.Action`1[T] loadAssemblyAction) [0x000b8] in <441f9d8d5faa47f8a553c27f47daee0c>:0 
  at Prepatcher.Process.GameProcessing.Process () [0x000fd] in <441f9d8d5faa47f8a553c27f47daee0c>:0 
  at Prepatcher.Loader.DoLoad () [0x00089] in <441f9d8d5faa47f8a553c27f47daee0c>:0 
  at Prestarter.ModManager.<Launch>b__59_0 () [0x00010] in <a27380c2fb8440a1b2c65caf92547e82>:0 
  at Verse.LongEventHandler.RunEventFromAnotherThread (System.Action action) [0x00008] in <38562b1a2ab64eacb931fb5df05ca994>:0  
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 39)

P.S.S. Enabled verbose logging https://gist.github.com/masakitenchi/29b1866c9713c6b3c5b1f8bf00972040

Zetrith commented 1 year ago

Prepatcher's verbose logging is enabled using the -verbose command line flag. It'd be great if you could provide a log with that enabled

masakitenchi commented 1 year ago

https://gist.github.com/masakitenchi/17098c91655da520615c22b414810276 Full log with -verbose Load order: Prepatcher (Workshop version) Core Royalty Ideology Biotech

Zetrith commented 1 year ago

It appears that you have a 0Harmony.dll file in RimWorld\RimWorldWin64_Data\Managed which Prepatcher doesn't like

masakitenchi commented 1 year ago

That's exactly what I should get rid of. Thanks for the help!