boformer / CitiesHarmony

Harmony 2.x assembly provider mod for Cities: Skylines
MIT License
73 stars 17 forks source link

Incompatible Mod: Theme Mixer 2 #3

Closed boformer closed 4 years ago

boformer commented 4 years ago

Crash to Desktop:

Patching method ColossalFramework.PlatformServices.UGCHandle ColossalFramework.PlatformServices.Workshop::UpdateItem(ColossalFramework.PlatformServices.PublishedFileId id, System.String title, System.String desc, System.String changeLog, System.String previewPath, System.String contentPath, System.String[] tags) (HarmonyId: com.tpb.thememixer2)

0x0000000004B6BA20 (Mono JIT Code) (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
0x0000000004B6B66D (Mono JIT Code) System.Reflection.MonoMethod:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
0x0000000004B6B490 (Mono JIT Code) System.Reflection.MethodBase:Invoke (object,object[])
0x000000001AE501D1 (Mono JIT Code) System.Reflection.Emit.DynamicMethod:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
0x0000000004B6B490 (Mono JIT Code) System.Reflection.MethodBase:Invoke (object,object[])
0x000000001AE4FE15 (Mono JIT Code) HarmonyLib.StructReturnBuffer:SizeOf (System.Type)
0x000000001ADA7802 (Mono JIT Code) HarmonyLib.StructReturnBuffer:NeedsFix (System.Reflection.MethodBase)
0x000000001ADA6A86 (Mono JIT Code) HarmonyLib.MethodPatcher:.ctor (System.Reflection.MethodBase,System.Reflection.MethodBase,System.Collections.Generic.List`1<System.Reflection.MethodInfo>,System.Collections.Generic.List`1<System.Reflection.MethodInfo>,System.Collections.Generic.List`1<System.Reflection.MethodInfo>,System.Collections.Generic.List`1<System.Reflection.MethodInfo>,bool)
0x000000001ADA36D3 (Mono JIT Code) HarmonyLib.PatchFunctions:UpdateWrapper (System.Reflection.MethodBase,HarmonyLib.PatchInfo)
0x000000001ADA1C3D (Mono JIT Code) HarmonyLib.PatchProcessor:Patch ()
0x000000001AE40383 (Mono JIT Code) CitiesHarmony.Harmony1201SelfPatcher:PatchProcessor_Patch_Prefix (object,System.Collections.Generic.List`1<System.Reflection.MethodBase>,object,object,object,System.Collections.Generic.List`1<System.Reflection.Emit.DynamicMethod>&)
0x00000000037A0646 (Mono JIT Code) (wrapper dynamic-method) Harmony.PatchProcessor:DMD<DMD<Patch_Patch1>?-245926656::Patch_Patch1> (Harmony.PatchProcessor)
0x000000001AE3B3FE (Mono JIT Code) Harmony.HarmonyInstance:<PatchAll>b__9_0 (System.Type)
0x0000000004B83BC8 (Mono JIT Code) Harmony.CollectionExtensions:Do<object> (System.Collections.Generic.IEnumerable`1<object>,System.Action`1<object>)
0x000000001AE3B2B8 (Mono JIT Code) Harmony.HarmonyInstance:PatchAll (System.Reflection.Assembly)
0x000000001AE4E37C (Mono JIT Code) ThemeMixer.Mod:InstallHarmony ()
0x000000001AE4CD83 (Mono JIT Code) ThemeMixer.Mod:OnEnabled ()
boformer commented 4 years ago

This patch causes crash to desktop:

[HarmonyPatch(typeof(Workshop), "UpdateItem", new Type[]
    {
        typeof(PublishedFileId),
        typeof(string),
        typeof(string),
        typeof(string),
        typeof(string),
        typeof(string),
        typeof(string[])
    })]
    public static class WorkshopUpdateItemPatch {
        private static void Prefix(string contentPath, ref string[] tags) {
            if (File.Exists(Path.Combine(contentPath, "ThemeMix.xml"))) {
                tags = new string[2]
                {
                "Map Theme",
                "Theme Mix"
                };
            }
        }
    }
boformer commented 4 years ago

Fixed by https://github.com/pardeike/Harmony/pull/276