Crash when you start Traffic without a keybind and try to change it
Describe the problem
Traffic doesn´t work correctly if you have a missing keybind. The issue only appears when you start the game without the keybind (I used Lane Connector). It results in Traffic not working and a possible crash.
Steps to reproduce
- Remove keybind for Lane Connector
- Restart game
- Try to do a Lane Connector change (Should not work)
- Try to get into Traffic menu to reset the keybind (Should crash)
Log files
Savegame?
Should not be needed, I can supply one, if the reproducer fails
Screenshots?
Not Needed
Notes or questions?
Error when accessing lane connector tool when keybind for it is missing:
[UI] [ERROR] Error in value binding 'Traffic.keybindings'
System.ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.Select[TSource,TResult] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] selector) [0x0000d] in <a314714511a14f84b853c03efd8682b8>:0
at Game.Input.ProxyBinding.Write (Colossal.UI.Binding.IJsonWriter writer) [0x0003c] in <407a0a0b0b484732bd578acd1adf3d7c>:0
at Colossal.UI.Binding.JsonWriterExtensions.Write[T] (Colossal.UI.Binding.IJsonWriter writer, T value) [0x00000] in <35225c09a38f4619afbd43dd567a5bf0>:0
at Traffic.UISystems.ModUISystem+ModKeyBinds.Write (Colossal.UI.Binding.IJsonWriter writer) [0x0001c] in D:\Modding\Cities Skylines II\Release\Traffic\Code\UISystems\ModUISystem.cs:360
at Colossal.UI.Binding.ValueWriter`1[T].Write (Colossal.UI.Binding.IJsonWriter writer, T value) [0x00008] in <35225c09a38f4619afbd43dd567a5bf0>:0
at Colossal.UI.Binding.GetterValueBinding`1[T].TriggerUpdateImpl () [0x0001e] in <35225c09a38f4619afbd43dd567a5bf0>:0
at Colossal.UI.Binding.GetterValueBinding`1[T].TriggerUpdate () [0x00028] in <35225c09a38f4619afbd43dd567a5bf0>:0
at Colossal.UI.Binding.GetterValueBinding`1[T].OnSubscribe () [0x00006] in <35225c09a38f4619afbd43dd567a5bf0>:0
I cannot reproduce the error 👀 I simply works, when key bind is not selected it shows "N/A" in the tooltip when you hover the tool button after opening the mod menu in game. I see that for some reason it doesn't sync key binding in the UI, but no errors or crashes.
I'm getting the exact same error, it used to work perfectly but now it doesn't work anymore. I believe it stopped working because I added another mod that uses the same keybind as Traffic.
[UI] [ERROR] Error in value binding 'Traffic.keybindings'
System.ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.Select[TSource,TResult] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] selector) [0x0000d] in <a314714511a14f84b853c03efd8682b8>:0
at Game.Input.ProxyBinding.Write (Colossal.UI.Binding.IJsonWriter writer) [0x0003c] in <6e65e54690eb41eea5f5e22cc56bb1ac>:0
at Colossal.UI.Binding.JsonWriterExtensions.Write[T] (Colossal.UI.Binding.IJsonWriter writer, T value) [0x00000] in <35225c09a38f4619afbd43dd567a5bf0>:0
at Traffic.UISystems.ModUISystem+ModKeyBinds.Write (Colossal.UI.Binding.IJsonWriter writer) [0x0001c] in D:\Modding\Cities Skylines II\Release\Traffic\Code\UISystems\ModUISystem.cs:360
at Colossal.UI.Binding.ValueWriter`1[T].Write (Colossal.UI.Binding.IJsonWriter writer, T value) [0x00008] in <35225c09a38f4619afbd43dd567a5bf0>:0
at Colossal.UI.Binding.GetterValueBinding`1[T].TriggerUpdateImpl () [0x0001e] in <35225c09a38f4619afbd43dd567a5bf0>:0
at Colossal.UI.Binding.GetterValueBinding`1[T].TriggerUpdate () [0x00028] in <35225c09a38f4619afbd43dd567a5bf0>:0
at Colossal.UI.Binding.GetterValueBinding`1[T].OnSubscribe () [0x00006] in <35225c09a38f4619afbd43dd567a5bf0>:0
Attempting to change any keybinds (base game and other mods) results in an instant crash.
@hexahigh could you share logs (Player.log, Traffic.Mod.log and Traffic.coc(if exists)) after changing the key binding or game crash?
I can't reproduce the problem. The mod works with conflicting keys as well as I can rebind the key to something else, remove completely or reset selected or all to the defaults, at any time.
Are you trying to use pdx launcher "Resume" button by chance? It's known that feature breaks mods because they are initialized during or often after the savegame data is being loaded resulting in missing mod data and/or other strange issues.
Yeah, I have been using the resume feature recently. Launching through the normal play button works perfectly. I was unaware that the resume button caused issues. Do you still want the log files from the crash?
Do you still want the log files from the crash?
Nope, I can reproduce the issue with "Resume" feature, but I can't fix it atm, at least not fully. I'll try to do something about crashing.