Patchwork icon indicating copy to clipboard operation
Patchwork copied to clipboard

Patch fails with "Internal message: The given key was not present in the dictionary."

Open FlotterCodername opened this issue 3 years ago • 0 comments

Describe the bug Unexpected patching failure of Tyranny's Assembly-CSharp.dll. I don't know why this happens; it's just a public class that I want to patch: public class UIConversationManager : UIHudWindow The issue persists even if I remove all the member modifications:

using Patchwork.Attributes;

namespace TyrannyHighDPI.pw
{
    [ModifiesType]
    public class ModUIConversationManager : UIConversationManager {}
}
2023-01-07 22:55:08.146 +01:00 [Information] Created patcher for assembly: Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
2023-01-07 22:55:08.196 +01:00 [Information] =====Creating new fields=====
2023-01-07 22:55:08.285 +01:00 [Error] An error has occurred,
While trying to: Patch the game
Error type: A system error or some sort of bug. (KeyNotFoundException)
Internal message: The given key was not present in the dictionary.

System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Patchwork.AssemblyPatcher.FixTypeReference(TypeReference yourTypeRef)
   at Patchwork.AssemblyPatcher.FixMethodReference(MethodReference yourMethodRef, Boolean isntFixTypeCall)
   at Patchwork.AssemblyPatcher.TransferMethodBody(MethodDefinition targetMethod, MethodDefinition yourMethod)
   at Patchwork.AssemblyPatcher.ModifyMethod(TypeDefinition targetType, MethodDefinition yourMethod, MemberActionAttribute memberAction, MethodDefinition targetMethod)
   at Patchwork.AssemblyPatcher.UpdateMethods(SimpleTypeLookup`1 methodActions)
   at Patchwork.AssemblyPatcher.PatchManifest(PatchingManifest manifest, ProgressObject o)
   at PatchworkLauncher.LaunchManager.ApplyInstructions(IEnumerable`1 patchGroups, ProgressObject po)
   at PatchworkLauncher.LaunchManager.<>c__DisplayClass46_0.<Command_Patch>b__0()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at PatchworkLauncher.LaunchManager.<Command_Patch>d__46.MoveNext()

Patch and Target Binaries TyrannyHighDPI.pw.zip I don't wanna get in trouble for sharing Obsidian's original file publicly. Can provide it on a person-to-person basis.

FlotterCodername avatar Jan 07 '23 22:01 FlotterCodername