Skip to content
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

Exception thrown during custom counter creation will break other counters #102

Open
qe201020335 opened this issue Aug 16, 2021 · 1 comment

Comments

@qe201020335
Copy link
Contributor

qe201020335 commented Aug 16, 2021

Describe the Bug
As the title, when Counter+ broadcasts a level start event to all the custom counters, if there is an uncought exception, it will cause this broadcast function to terminate. As a result all the counters that would load after this bugged counter will not reveive the event. Then they won't load.

Attach or Link Files
This comment in the issue of my custom counter shows the log when my custom counter threw an uncought exception.

[INFO @ 19:46:02 | HRCounter] Refreshing Settings
[INFO @ 19:46:02 | HRCounter] Creating counter
[INFO @ 19:46:02 | HRCounter] Creating new WebSocket
[INFO @ 19:46:02 | _] 14/08/2021 19:46:02|Fatal|WebSocket.connect|An error has occurred during a TLS handshake.
[CRITICAL @ 19:46:02 | SiraUtil] Error occurred while initializing IInitializable with type 'CountersPlus.Counters.Event_Broadcasters.CounterEventBroadcaster'
[CRITICAL @ 19:46:02 | SiraUtil] System.InvalidOperationException: The current state of the connection is not Open.
[CRITICAL @ 19:46:02 | SiraUtil]   at WebSocketSharp.WebSocket.Send (System.String data) [0x0001a] in <7a2bdf4fe6004810ba771c682597b1d8>:0 
[CRITICAL @ 19:46:02 | SiraUtil]   at HRCounter.Data.HypeRate.CreateAndConnectSocket () [0x0007e] in <058d33a233044f7692f5b438d1c18b19>:0 
[CRITICAL @ 19:46:02 | SiraUtil]   at HRCounter.Data.HypeRate.Start () [0x00007] in <058d33a233044f7692f5b438d1c18b19>:0 
[CRITICAL @ 19:46:02 | SiraUtil]   at HRCounter.HRCounter.CounterInit () [0x00053] in <058d33a233044f7692f5b438d1c18b19>:0 
[CRITICAL @ 19:46:02 | SiraUtil]   at CountersPlus.Counters.Event_Broadcasters.CounterEventBroadcaster.Initialize () [0x00015] in <85e7d6fc15a141cb8afa3ea6afdf8fc6>:0 
[CRITICAL @ 19:46:02 | SiraUtil]   at (wrapper dynamic-method) Zenject.InitializableManager.DMD<Zenject.InitializableManager::Initialize>(Zenject.InitializableManager)

Maybe add a try block into the CounterEventBroadcaster.Initialize foreach loop? So a bugged counter won't affect others.

Additional context
This problem was found when fixing my own custom counter. lol

@qe201020335
Copy link
Contributor Author

qe201020335 commented Aug 16, 2021

A longer log that happened during my own testing

[NOTICE @ 04:07:38 | Counters+] Loading counters...
[DEBUG @ 04:07:38 | Counters+] {CountersPlus.Installers.CountersInstaller::AddCustomCounter(CountersPlus.Custom.CustomCounter, System.Type)} Loading counter Heart Rate Counter...
[DEBUG @ 04:07:38 | Counters+] {CountersPlus.Installers.CountersInstaller::AddCustomCounter(CountersPlus.Custom.CustomCounter, System.Type)} Loading counter PP Counter...
[NOTICE @ 04:07:38 | Counters+] Counters loaded!
[INFO @ 04:07:39 | HRCounter] Refreshing Settings
[INFO @ 04:07:39 | HRCounter] Creating counter
[INFO @ 04:07:39 | HRCounter] Creating new WebSocket
[INFO @ 04:07:39 | _] 2021/8/16 4:07:39|Fatal|WebSocket.connect|An error has occurred during a TLS handshake.
[CRITICAL @ 04:07:39 | SiraUtil] Error occurred while initializing IInitializable with type 'CountersPlus.Counters.Event_Broadcasters.CounterEventBroadcaster'
[CRITICAL @ 04:07:39 | SiraUtil] System.InvalidOperationException: The current state of the connection is not Open.
[CRITICAL @ 04:07:39 | SiraUtil]   at WebSocketSharp.WebSocket.Send (System.String data) [0x0001a] in <7a2bdf4fe6004810ba771c682597b1d8>:0 
[CRITICAL @ 04:07:39 | SiraUtil]   at HRCounter.Data.HypeRate.CreateAndConnectSocket () [0x0007e] in <058d33a233044f7692f5b438d1c18b19>:0 
[CRITICAL @ 04:07:39 | SiraUtil]   at HRCounter.Data.HypeRate.Start () [0x00007] in <058d33a233044f7692f5b438d1c18b19>:0 
[CRITICAL @ 04:07:39 | SiraUtil]   at HRCounter.HRCounter.CounterInit () [0x00053] in <058d33a233044f7692f5b438d1c18b19>:0 
[CRITICAL @ 04:07:39 | SiraUtil]   at CountersPlus.Counters.Event_Broadcasters.CounterEventBroadcaster.Initialize () [0x00015] in <85e7d6fc15a141cb8afa3ea6afdf8fc6>:0 
[CRITICAL @ 04:07:39 | SiraUtil]   at (wrapper dynamic-method) Zenject.InitializableManager.DMD<Zenject.InitializableManager::Initialize>(Zenject.InitializableManager)
[WARNING @ 04:07:39 | SiraUtil] Please tell Caeden117 to fix this!
[WARNING @ 04:07:39 | SiraUtil] Please tell Caeden117 to fix this!
[WARNING @ 04:07:39 | SiraUtil] Please tell Caeden117 to fix this!
[WARNING @ 04:07:39 | SiraUtil] Please tell Caeden117 to fix this!
[WARNING @ 04:07:39 | SiraUtil] Please tell Caeden117 to fix this!
[WARNING @ 04:07:39 | SiraUtil] Please tell Caeden117 to fix this!
[WARNING @ 04:07:39 | SiraUtil] Please tell Caeden117 to fix this!
[WARNING @ 04:07:39 | SiraUtil] Please tell Caeden117 to fix this!
[WARNING @ 04:07:39 | SiraUtil] Please tell Caeden117 to fix this!
[WARNING @ 04:07:39 | SiraUtil] Please tell Caeden117 to fix this!

Here PP counter did not show up beacuse my mod threw an uncaught exception during initialization

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant