-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mod confict report when both TMPE and other mods use harmony to patch the same method #747
Comments
Info 805.2317943: ThreadingExtension.OnBeforeSimulationFrame: First frame detected. Detours checked. Result: 1 missing detours
- Error 805.2326772: Traffic Manager: President Edition detected an incompatibility with another mod! You can continue playing but it's NOT recommended. Traffic Manager will not work as expected. See TMPE.log for technical details.
at CSUtil.Commons.Log.LogToFile(System.String log, LogLevel level)
at CSUtil.Commons.Log.Error(System.String s)
at TrafficManager.ThreadingExtension.OnBeforeSimulationFrame()
at ThreadingWrapper.OnBeforeSimulationFrame()
at SimulationManager.SimulationStep()
at SimulationManager.SimulationThread()
Info 805.2739730: The following methods were overriden by another mod:
- <Harmony> RoadBaseAI.UpdateLanes with 3 parameters (RoadBaseAI, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null) Note to TMPE team: Doesn't Harmony provide a namespace key for it's patches? If so, could we display the conflicting namespace which would help track down conflicts when the other mod is using Harmony? |
OK, I think I figured out what is wrong. To make patching compatible @CitiesSkylinesMods/tmpe would have to migrate to I think there are no other options from your side, because you are patching methods of struct instances. That feature is not supported by Another issue is that |
harmony2.0 is not compatiable with harmony1.2, so if TMPE is using Harmony 2.0.0.X, I do not think TMPE can compatiable with other mod which is using harmony1.2 In fact, In order to compatiable with mod which is using harmony1.2, I modified Harmony 2.0.0.X, remove some new features and rename it as harmony 1.9.9.9 Please see this issue: |
Let`s make this clear. Do you mean to make TMPE and CSUR toolbox compatiable, we should both use harmony2.0.0.X or both use harmony1.2.0.1 ? |
@pcfantasy Exactly, we currently use Harmony 1.2.0.1 and as I said earlier, your CSUR Toolbox can't use harmony 1.2.0.1 because some of your patches will fail to apply. I pulled your repo to test if backward migration is possible and nope, I couldn't patch some of methods you use. |
Thanks, I understand this now. I have a workaround to patch another place until TMPE move to new harmony. BTW, it is not easy to move TMPE to harmony. As I said, I tried before. But harmony2.0 do not compatiable with harmony1.2. So if some mods still use harmony1.2, there will be a conflict. So what do you think about this, or if TMPE want to update to harmony2.0, please notify all other modders. |
Yes, we are aware that both versions are incompatible. The easiest way for us would be to update both v11 versions at a time. We will try to notify other modders before we release updated version. |
The move to Harmony 2 is going to happen sooner or later anyway, as we already see with CSUR Toolbox, Network Skins 2, etc.... there is a need for the features of Harmony 2. If necessary we could work with other modders to help them migrate to Harmony 2. A lot of the much older mods are still using the old detours library by cope. Maybe there is some way we could determine which mods are using Harmony, and if so which version of Harmony they are using? Possibly a small mod that could be subscribed which would log details to game log? |
@krzychu124 @aubergine10 Agree, notify me if any plan about harmony2.0, thanks. |
Updated: Uses reported that actually both functions are working normally. |
Note: although all the assemblies are loaded into the app domain, |
Do you mean if one mod A use harmony1.2, another mod B use harmony1.3(local build and hacked for some new functions). But in fact, both mods may all use harmony1.2 to patch method. So in the case, B mod want to use local hacked harmony1.3 for new functions but the new functions may not work as experted, because in fact B mod is still using harmony1.2. Is my understanding right? |
There is no way for a mod to say which version of harmony it wants; if there are multiple harmony assemblies loaded (different versions) only one of those harmony assembly versions will be used by all mods. It's exact same problem that RimWorld modders had; whichever version of harmony loads first is used by all other mods, regardless of what versions of harmony those other mods bundled. |
@aubergine10 Not exactly? You see that NS2 and CSUR toolbox all want new harmony function to patch struct instance. The two mod use local builded harmony version. Until now, both mod works fine in steam, if NS2 and CSUR toolbox patch is forced by other mod`s harmony1.2. Their patches should not apply to struct instance, and will cause function issue. |
Maybe @pardeike could confirm one way or the other? |
Maybe a bit long but it sums up what RimWorld went through: Later in the comments to that story there is a technical post where I explain the details. |
@pcfantasy
I turns out that I was not quite correct. The game is capable to provide the requested version of the assembly. But if there are multiple instances with same version loaded, there is no guarantee which instance of them will be used. |
There is a method that returns the harmony version: https://harmony.pardeike.net/api/HarmonyLib.Harmony.html#HarmonyLib_Harmony_VersionInfo_System_Version__ |
Thanks for your information. |
v1.2.0 of Duplicate Assembly Scanner is now in PR review - useful tool if you want to get an idea of which C:SL mods are using Harmony and which of the assemblies are loaded in to app domain, etc: CitiesSkylinesMods/DuplicateAssemblyScanner#16 Note that a mod doesn't even need to be enabled for it's |
TMPE.log
output_log(6).txt
@krzychu124 @aubergine10
I update CSUR toolbox, some users sometime will report mod conflict.
Both CSUR toolbox and TMPE use harmony to patch RoadBaseAI.UpdateLanes now. This confict should not happen, I do not know why.
https://github.com/citiesskylines-csur/CSURToolBox/blob/master/Patch/RoadBaseAIUpdateLanesPatch.cs
#611
The text was updated successfully, but these errors were encountered: