{"action":"created","issue":{"url":"https://api.github.com/repos/george-jones/csm-exportelectricity/issues/2","repository_url":"https://api.github.com/repos/george-jones/csm-exportelectricity","labels_url":"https://api.github.com/repos/george-jones/csm-exportelectricity/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/george-jones/csm-exportelectricity/issues/2/comments","events_url":"https://api.github.com/repos/george-jones/csm-exportelectricity/issues/2/events","html_url":"https://github.com/george-jones/csm-exportelectricity/issues/2","id":161038046,"number":2,"title":"Mod causing crashes","user":{"login":"InsaneBuildEnvironment","id":6621178,"avatar_url":"https://avatars.githubusercontent.com/u/6621178?v=3","gravatar_id":"","url":"https://api.github.com/users/InsaneBuildEnvironment","html_url":"https://github.com/InsaneBuildEnvironment","followers_url":"https://api.github.com/users/InsaneBuildEnvironment/followers","following_url":"https://api.github.com/users/InsaneBuildEnvironment/following{/other_user}","gists_url":"https://api.github.com/users/InsaneBuildEnvironment/gists{/gist_id}","starred_url":"https://api.github.com/users/InsaneBuildEnvironment/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/InsaneBuildEnvironment/subscriptions","organizations_url":"https://api.github.com/users/InsaneBuildEnvironment/orgs","repos_url":"https://api.github.com/users/InsaneBuildEnvironment/repos","events_url":"https://api.github.com/users/InsaneBuildEnvironment/events{/privacy}","received_events_url":"https://api.github.com/users/InsaneBuildEnvironment/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-06-18T18:46:55Z","updated_at":"2016-06-21T18:42:03Z","closed_at":null,"body":"It seems like this mod is causing the game to crash. Not sure what circumstances cause the crash, but here's the stack trace from the first time it happened:\r\n\r\n```\r\n00007FF7AD0765D6 (Cities) Scripting::ScriptingWrapperFor\r\n0000000005BE345C (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Object:FindObjectsOfType (System.Type)\r\n0000000068A8E119 (Mono JIT Code) UnityEngine.Object:FindObjectsOfType<object> ()\r\n0000000149C1ADF5 (Mono JIT Code) ExportElectricityMod.EconomyExtension:OnUpdateMoneyAmount (long)\r\n0000000149C1AD3B (Mono JIT Code) EconomyWrapper:OnUpdateMoneyAmount (long)\r\n0000000016469D5D (Mono JIT Code) EconomyManager:SimulationStepImpl (int)\r\n000000001643B06D (Mono JIT Code) SimulationManagerBase`2<object, object>:SimulationStep (int)\r\n00000000164692F5 (Mono JIT Code) EconomyManager:ISimulationManager.SimulationStep (int)\r\n0000000016250B54 (Mono JIT Code) SimulationManager:SimulationStep ()\r\n0000000016230FBB (Mono JIT Code) SimulationManager:SimulationThread ()\r\n0000000005BA8BBB (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)\r\n00007FFAD73E4043 (mono) mono_set_defaults\r\n00007FFAD73383AD (mono) mono_runtime_invoke\r\n00007FFAD7361743 (mono) mono_thread_interruption_request_flag\r\n00007FFAD7416889 (mono) unity_mono_method_is_generic\r\n00007FFAFF528102 (KERNEL32) BaseThreadInitThunk\r\n00007FFAFF78C5B4 (ntdll) RtlUserThreadStart\r\n```\r\n\r\nAnd the second time:\r\n```\r\n00007FF60F9665D6 (Cities) Scripting::ScriptingWrapperFor\r\n00000000058B345C (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Object:FindObjectsOfType (System.Type)\r\n0000000015E2C379 (Mono JIT Code) UnityEngine.Object:FindObjectsOfType<object> ()\r\n00000001AC654023 (Mono JIT Code) ExportElectricityMod.EconomyExtension:OnUpdateMoneyAmount (long)\r\n00000001AC653CDB (Mono JIT Code) EconomyWrapper:OnUpdateMoneyAmount (long)\r\n0000000146DBC08D (Mono JIT Code) EconomyManager:SimulationStepImpl (int)\r\n00000001BBC0DB5D (Mono JIT Code) SimulationManagerBase`2<object, object>:SimulationStep (int)\r\n0000000146DBAF85 (Mono JIT Code) EconomyManager:ISimulationManager.SimulationStep (int)\r\n0000000015DE3334 (Mono JIT Code) SimulationManager:SimulationStep ()\r\n0000000015DC379B (Mono JIT Code) SimulationManager:SimulationThread ()\r\n0000000005878BBB (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)\r\n00007FFAD7274043 (mono) mono_set_defaults\r\n00007FFAD71C83AD (mono) mono_runtime_invoke\r\n00007FFAD71F1743 (mono) mono_thread_interruption_request_flag\r\n00007FFAD72A6889 (mono) unity_mono_method_is_generic\r\n00007FFAFF528102 (KERNEL32) BaseThreadInitThunk\r\n00007FFAFF78C5B4 (ntdll) RtlUserThreadStart\r\n```"},"comment":{"url":"https://api.github.com/repos/george-jones/csm-exportelectricity/issues/comments/227533164","html_url":"https://github.com/george-jones/csm-exportelectricity/issues/2#issuecomment-227533164","issue_url":"https://api.github.com/repos/george-jones/csm-exportelectricity/issues/2","id":227533164,"user":{"login":"DinkyToyz","id":10909887,"avatar_url":"https://avatars.githubusercontent.com/u/10909887?v=3","gravatar_id":"","url":"https://api.github.com/users/DinkyToyz","html_url":"https://github.com/DinkyToyz","followers_url":"https://api.github.com/users/DinkyToyz/followers","following_url":"https://api.github.com/users/DinkyToyz/following{/other_user}","gists_url":"https://api.github.com/users/DinkyToyz/gists{/gist_id}","starred_url":"https://api.github.com/users/DinkyToyz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DinkyToyz/subscriptions","organizations_url":"https://api.github.com/users/DinkyToyz/orgs","repos_url":"https://api.github.com/users/DinkyToyz/repos","events_url":"https://api.github.com/users/DinkyToyz/events{/privacy}","received_events_url":"https://api.github.com/users/DinkyToyz/received_events","type":"User","site_admin":false},"created_at":"2016-06-21T18:42:03Z","updated_at":"2016-06-21T18:42:03Z","body":"I haven't tried using this mod yet myself, but since the crash happens in UnityEngine.Object:FindObjectsOfType, and you use that for getting managers, it might be worth it to get the managers another way:\r\n\r\nThe normal way of getting a manager instance is this way:\r\nDistrictManager districtManager = Singleton<DistrictManager>.instance\r\nEconomyManager economyManager = Singleton<EconomyManager>.instance;\r\n\r\nI'd also suggest using try-catch blocks to catch and log exceptions in the mod, and setting a flag either at the first exception or after a certain number of exceptions in order to skip doing anything if the mod breaks. That way you can get better exception info, and avoid hindering the game too much. (You can use DebugOutputPanel.AddMessage and UnityEngine.Debug.Log for logging errors)."}}
{"actor":{"display_login":"DinkyToyz"}}