yenyang / Tree_Controller_BepInEx

4 stars 0 forks source link

Error Code #5

Closed swedpool closed 8 months ago

swedpool commented 8 months ago

Hi,

When trying to use Tree Controller 1.1.0, I get the following error message:

[ERROR] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'System.Windows.Forms.XplatUI' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Windows.Forms.Application' threw an exception. ---> System.Globalization.CultureNotFoundException: Culture ID 1034 (0x040A) is not a supported culture. Parameter name: culture at System.Globalization.CultureInfo..ctor (System.Int32 culture, System.Boolean useUserOverride, System.Boolean read_only) [0x0007d] in :0 at System.Globalization.CultureInfo.GetCultureInfo (System.Int32 culture) [0x0003e] in :0 at System.Windows.Forms.InputLanguage.get_InstalledInputLanguages () [0x00040] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 at System.Windows.Forms.InputLanguage.FromCulture (System.Globalization.CultureInfo culture) [0x00000] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 at System.Windows.Forms.InputLanguage.get_CurrentInputLanguage () [0x0000c] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 at System.Windows.Forms.Application..cctor () [0x00000] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 --- End of inner exception stack trace --- at System.Windows.Forms.XplatUI..cctor () [0x000ee] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 --- End of inner exception stack trace --- at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr) at System.Windows.Forms.XplatUI+State.get_ModifierKeys () [0x00000] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 at System.Windows.Forms.Control.get_ModifierKeys () [0x00000] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 at Tree_Controller.Tools.TreeControllerUISystem.OnPrefabChanged (Game.Prefabs.PrefabBase prefab) [0x0025f] in <7ee210e6b85c4f148392ea97cb2a3078>:0 at (wrapper delegate-invoke) System.Action`1[Game.Prefabs.PrefabBase].invoke_void_T(Game.Prefabs.PrefabBase) at Tree_Controller.Tools.TreeControllerTool.SelectTreePrefab (Game.Prefabs.PrefabBase prefab) [0x000cd] in <7ee210e6b85c4f148392ea97cb2a3078>:0 at Tree_Controller.Tools.TreeControllerUISystem.ChangePrefabSet (System.String prefabSetID) [0x0021d] in <7ee210e6b85c4f148392ea97cb2a3078>:0 at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&) at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in :0 --- End of inner exception stack trace --- at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00083] in :0 at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in :0 at cohtml.Net.Invoker.ExecuteAndSendResult (cohtml.Net.Binder binder, System.Delegate callback, System.Object[] arguments, System.Boolean execute) [0x00027] in <34a70e0068754567b86b66a15ff313c5>:0 Colossal.Logging.CustomLogHandler:LogFormat(LogType, Object, String, Object[]) UnityEngine.Logger:LogFormat(LogType, String, Object[]) Colossal.Logging.UnityLogger:Log(Level, String, Exception) Colossal.Logging.UnityLogger:Error(Object) Colossal.UI.LogHandler:WriteLog(Severity, String, UInt32) cohtml.Net.ILogHandler:SwigDirectorWriteLog(Int32, String, UInt32) cohtml.Net.cohtmlNativePINVOKE:ILogHandler_WriteLog(HandleRef, Int32, String, UInt32) cohtml.Net.ILogHandler:WriteLog(Severity, String, UInt32) cohtml.Net.Binder:LogException(Exception) cohtml.Net.Invoker:ExecuteAndSendResult(Binder, Delegate, Object[], Boolean) cohtml.Net.Invoker:Invoke(Int32) cohtml.Net.cohtmlNativePINVOKE:View_MouseEvent(HandleRef, HandleRef) cohtml.Net.View:MouseEvent(IMouseEventData) Colossal.UI.UIInputSystem:DispatchInputEvents(UIView, Boolean, InputEventType) Colossal.UI.UIInputSystem:DispatchInputEvents() Game.SceneFlow.GameManager:Update()

Tree Controller 1.0.0 works without problem. I suspect that the problem is related to the fact that I am running Cities Skylines 2 on Linux (Debian Bookworm) via Proton, but that is just a guess. I have also attached the error window from the game. 20240212141035_1

Thanks in advance for your help.

yenyang commented 8 months ago

I think I understand why that's happening. I will try to find another way to determine whether the user is pressing Ctrl other than that windows form method. Hopefully that will fix it. It's not something I can test for myself, since I don't have a PC that runs linux.

nbeerten commented 8 months ago

@yenyang I get the same error:

[ERROR]  Error in trigger binding callback 'toolbar.selectAsset' 'toolbar' 'selectAsset'
CultureNotFoundException: Culture ID 8192 (0x2000) is not a supported culture.
Parameter name: culture
  at System.Globalization.CultureInfo..ctor (System.Int32 culture, System.Boolean useUserOverride, System.Boolean read_only) [0x0007d] in <b89873cb176e44a995a4781c7487d410>:0 
  at System.Globalization.CultureInfo.GetCultureInfo (System.Int32 culture) [0x0003e] in <b89873cb176e44a995a4781c7487d410>:0 
  at System.Windows.Forms.InputLanguage.get_InstalledInputLanguages () [0x00040] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 
  at System.Windows.Forms.InputLanguage.FromCulture (System.Globalization.CultureInfo culture) [0x00000] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 
  at System.Windows.Forms.InputLanguage.get_CurrentInputLanguage () [0x0000c] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 
  at System.Windows.Forms.Application..cctor () [0x00000] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 
Rethrow as TypeInitializationException: The type initializer for 'System.Windows.Forms.Application' threw an exception.
  at System.Windows.Forms.XplatUI..cctor () [0x000ee] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 
Rethrow as TypeInitializationException: The type initializer for 'System.Windows.Forms.XplatUI' threw an exception.
  at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
  at System.Windows.Forms.XplatUI+State.get_ModifierKeys () [0x00000] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 
  at System.Windows.Forms.Control.get_ModifierKeys () [0x00000] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 
  at Tree_Controller.Patches.ObjectToolSystemTrySetPrefabPatch.Prefix (Game.Prefabs.PrefabBase& prefab, System.Boolean& __result) [0x000e7] in <7ee210e6b85c4f148392ea97cb2a3078>:0 
  at (wrapper dynamic-method) Game.Tools.ObjectToolSystem.DMD<Game.Tools.ObjectToolSystem::TrySetPrefab>(Game.Tools.ObjectToolSystem,Game.Prefabs.PrefabBase)
  at Game.Tools.ToolSystem.ActivatePrefabTool (Game.Prefabs.PrefabBase prefab) [0x0001f] in <8bc3bf147d90443fb3df643f5b67c57a>:0 
  at Game.UI.InGame.ToolbarUISystem.ActivatePrefabTool (Unity.Entities.Entity assetEntity) [0x0003e] in <8bc3bf147d90443fb3df643f5b67c57a>:0 
  at Game.UI.InGame.ToolbarUISystem.SelectAsset (Unity.Entities.Entity assetEntity, System.Boolean updateTool) [0x000be] in <8bc3bf147d90443fb3df643f5b67c57a>:0 
  at Game.UI.InGame.ToolbarUISystem.SelectAsset (Unity.Entities.Entity asset) [0x00000] in <8bc3bf147d90443fb3df643f5b67c57a>:0 
  at Colossal.UI.Binding.TriggerBinding`1[T].Callback () [0x00013] in <9057189dbf174a4da314eb8f3a556c98>:0 
Colossal.Logging.CustomLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:LogFormat(LogType, String, Object[])
Colossal.Logging.UnityLogger:Log(Level, String, Exception)
Colossal.Logging.UnityLogger:Error(Exception, Object)
Colossal.UI.Binding.TriggerBinding`1:Callback()
System.Reflection.RuntimeMethodInfo:InternalInvoke(RuntimeMethodInfo, Object, Object[], Exception&)
System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
System.Reflection.MethodBase:Invoke(Object, Object[])
cohtml.Net.Invoker:ExecuteAndSendResult(Binder, Delegate, Object[], Boolean)
cohtml.Net.Invoker:Invoke(Int32)
cohtml.Net.cohtmlNativePINVOKE:View_MouseEvent(HandleRef, HandleRef)
cohtml.Net.View:MouseEvent(IMouseEventData)
Colossal.UI.UIInputSystem:DispatchInputEvents(UIView, Boolean, InputEventType)
Colossal.UI.UIInputSystem:DispatchInputEvents()
Game.SceneFlow.GameManager:Update()

Steps to reproduce (tested with a bunch of mods and also reproduced with only tree controller + it's dependencies):

  1. Open a save
  2. Go to the trees tab
  3. Select the brush
  4. Click on another tree
  5. (error will show up)

100% consistently happening, no pressing Ctrl or anything. Just switching trees while in the brush mode does it.

https://github.com/yenyang/Tree_Controller_BepInEx/assets/59444993/72945550-fe01-4cfc-b524-1aa6af60e397

yenyang commented 8 months ago

@yenyang I get the same error:

[ERROR]  Error in trigger binding callback 'toolbar.selectAsset' 'toolbar' 'selectAsset'
CultureNotFoundException: Culture ID 8192 (0x2000) is not a supported culture.
Parameter name: culture
  at System.Globalization.CultureInfo..ctor (System.Int32 culture, System.Boolean useUserOverride, System.Boolean read_only) [0x0007d] in <b89873cb176e44a995a4781c7487d410>:0 
  at System.Globalization.CultureInfo.GetCultureInfo (System.Int32 culture) [0x0003e] in <b89873cb176e44a995a4781c7487d410>:0 
  at System.Windows.Forms.InputLanguage.get_InstalledInputLanguages () [0x00040] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 
  at System.Windows.Forms.InputLanguage.FromCulture (System.Globalization.CultureInfo culture) [0x00000] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 
  at System.Windows.Forms.InputLanguage.get_CurrentInputLanguage () [0x0000c] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 
  at System.Windows.Forms.Application..cctor () [0x00000] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 
Rethrow as TypeInitializationException: The type initializer for 'System.Windows.Forms.Application' threw an exception.
  at System.Windows.Forms.XplatUI..cctor () [0x000ee] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 
Rethrow as TypeInitializationException: The type initializer for 'System.Windows.Forms.XplatUI' threw an exception.
  at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
  at System.Windows.Forms.XplatUI+State.get_ModifierKeys () [0x00000] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 
  at System.Windows.Forms.Control.get_ModifierKeys () [0x00000] in <8ce253beec59426e9ec61d65e4cb0f6d>:0 
  at Tree_Controller.Patches.ObjectToolSystemTrySetPrefabPatch.Prefix (Game.Prefabs.PrefabBase& prefab, System.Boolean& __result) [0x000e7] in <7ee210e6b85c4f148392ea97cb2a3078>:0 
  at (wrapper dynamic-method) Game.Tools.ObjectToolSystem.DMD<Game.Tools.ObjectToolSystem::TrySetPrefab>(Game.Tools.ObjectToolSystem,Game.Prefabs.PrefabBase)
  at Game.Tools.ToolSystem.ActivatePrefabTool (Game.Prefabs.PrefabBase prefab) [0x0001f] in <8bc3bf147d90443fb3df643f5b67c57a>:0 
  at Game.UI.InGame.ToolbarUISystem.ActivatePrefabTool (Unity.Entities.Entity assetEntity) [0x0003e] in <8bc3bf147d90443fb3df643f5b67c57a>:0 
  at Game.UI.InGame.ToolbarUISystem.SelectAsset (Unity.Entities.Entity assetEntity, System.Boolean updateTool) [0x000be] in <8bc3bf147d90443fb3df643f5b67c57a>:0 
  at Game.UI.InGame.ToolbarUISystem.SelectAsset (Unity.Entities.Entity asset) [0x00000] in <8bc3bf147d90443fb3df643f5b67c57a>:0 
  at Colossal.UI.Binding.TriggerBinding`1[T].Callback () [0x00013] in <9057189dbf174a4da314eb8f3a556c98>:0 
Colossal.Logging.CustomLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:LogFormat(LogType, String, Object[])
Colossal.Logging.UnityLogger:Log(Level, String, Exception)
Colossal.Logging.UnityLogger:Error(Exception, Object)
Colossal.UI.Binding.TriggerBinding`1:Callback()
System.Reflection.RuntimeMethodInfo:InternalInvoke(RuntimeMethodInfo, Object, Object[], Exception&)
System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
System.Reflection.MethodBase:Invoke(Object, Object[])
cohtml.Net.Invoker:ExecuteAndSendResult(Binder, Delegate, Object[], Boolean)
cohtml.Net.Invoker:Invoke(Int32)
cohtml.Net.cohtmlNativePINVOKE:View_MouseEvent(HandleRef, HandleRef)
cohtml.Net.View:MouseEvent(IMouseEventData)
Colossal.UI.UIInputSystem:DispatchInputEvents(UIView, Boolean, InputEventType)
Colossal.UI.UIInputSystem:DispatchInputEvents()
Game.SceneFlow.GameManager:Update()

Steps to reproduce (tested with a bunch of mods and also reproduced with only tree controller + it's dependencies):

  1. Open a save
  2. Go to the trees tab
  3. Select the brush
  4. Click on another tree
  5. (error will show up)

100% consistently happening, no pressing Ctrl or anything. Just switching trees while in the brush mode does it.

2024-02-12.19-40-04.60.-.Trim.mp4

Are you also on Linux? Or do you use windows operating system?

It's not about pressing Ctrl its an error caused by trying to check if the user is pressing Ctrl but not having the culture information to understand what Ctrl key is on your computer. The two of you have different culture key's but it's not something I am familiar with to understand what the culture key means.

The solution I believe is to find a different way to check if the user is pressing Ctrl.

nbeerten commented 8 months ago

@yenyang I am on Windows 11.

yenyang commented 8 months ago

@nbeerten @swedpool yenyang-Tree_Controller.zip Could one of you two please test the build in the attached zip file? You can just replace the dll in your mod manager/plugins folder for Tree controller v1.1 with the one from the zip.

nbeerten commented 8 months ago

@nbeerten @swedpool yenyang-Tree_Controller.zip Could one of you two please test the build in the attached zip file? You can just replace the dll in your mod manager/plugins folder for Tree controller v1.1 with the one from the zip.

This version fully works yes, no error anymore The Ctrl to select more than 1 tree also works

yenyang commented 8 months ago

I’m glad you figured out where the file needed to go. I will post a patch later today. Thank you for the report and test.

Edit: Actually probably tomorrow, got something else I want to add and some extra time for quality control is warranted.

On Mon, Feb 12, 2024 at 12:23 PM nbeerten @.***> wrote:

@nbeerten https://github.com/nbeerten @swedpool https://github.com/swedpool yenyang-Tree_Controller.zip https://github.com/yenyang/Tree_Controller_BepInEx/files/14250345/yenyang-Tree_Controller.zip Could one of you two please test the build in the attached zip file? You can just replace the dll in your mod manager/plugins folder for Tree controller v1.1 with the one from the zip.

This version fully works yes, no error anymore

— Reply to this email directly, view it on GitHub https://github.com/yenyang/Tree_Controller_BepInEx/issues/5#issuecomment-1939513104, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIKNUESI2ZEE7IKRHUUE6TYTJ237AVCNFSM6AAAAABDEXZJ6KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZZGUYTGMJQGQ . You are receiving this because you were mentioned.Message ID: @.***>

swedpool commented 8 months ago

I can confirm that it works like a charm in Linux too, after replacing the files in the mod-folder with the ones in the zip-file. Many thanks for your help!

yenyang commented 8 months ago

Glad it worked!

On Mon, Feb 12, 2024 at 10:48 PM swedpool @.***> wrote:

I can confirm that it works like a charm in Linux too, after replacing the files in the mod-folder with the ones in the zip-file. Many thanks for your help!

— Reply to this email directly, view it on GitHub https://github.com/yenyang/Tree_Controller_BepInEx/issues/5#issuecomment-1940518405, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIKNUHEMNL55TPDBGUAGS3YTMEERAVCNFSM6AAAAABDEXZJ6KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBQGUYTQNBQGU . You are receiving this because you were mentioned.Message ID: @.***>

yenyang commented 8 months ago

Should be resolved with V1.1.1