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

clicking on vehicle restriction handles throws hidden exception #744

Closed
kianzarrin opened this issue Feb 26, 2020 · 9 comments · Fixed by #746
Closed

clicking on vehicle restriction handles throws hidden exception #744

kianzarrin opened this issue Feb 26, 2020 · 9 comments · Fixed by #746
Labels
BUG Defect detected confirmed Represents confirmed issue or bug VEHICLE RESTRICTIONS Feature: Vehicle restrictions

Comments

@kianzarrin
Copy link
Collaborator

see #721 (review)
we should also check for other tools too.

@kianzarrin kianzarrin added BUG Defect detected triage Awaiting issue categorisation labels Feb 26, 2020
@originalfoo
Copy link
Member

I tried with other tools but couldn't get that error. Seems to only affect Vehicle Restricitons.

Note: I was just randomly clicking stuff so not sure what specifically causes the error; as such it's possible error is there in other tools so still do some extra testing on that.

@originalfoo originalfoo added confirmed Represents confirmed issue or bug VEHICLE RESTRICTIONS Feature: Vehicle restrictions and removed triage Awaiting issue categorisation labels Feb 26, 2020
@krzychu124
Copy link
Member

I think that occurs only with shift click.

@originalfoo
Copy link
Member

Tried various key modifiers with various tools; only one throwing errors is Vehicle Restrictions.

Log file from current 11.1.0 master branch
TMPE.log

@krzychu124
Copy link
Member

krzychu124 commented Feb 26, 2020

@kianzarrin

I put some debug logs which suggest it is the foreach( lanes in sortedlanes) that is throwing the exception. but sortedlanes has not changed.

You are searching in a wrong place. Exception is thrown in ShowSigns().
The problem is that signs are rendered while you are refreshing list of this.currentRestrictedSegmentIds by applying restrictions to segments.
It is possible because base.OnToolGUI is called from Update and from OnGUI

I think we should investigate if current implementation of interactions is correctly set up.

@kianzarrin
Copy link
Collaborator Author

@krzychu124 when fixing a single segment, the refresh is delayed. but when fixing multiple segments it is not. so that's why way of fixing it. but honestly, i'd just return and try again next loop.

@krzychu124
Copy link
Member

krzychu124 commented Feb 26, 2020

you could convert hashset to array and use regular for (that would fix exception for sure) - random idea

@kianzarrin
Copy link
Collaborator Author

you could convert hashset to array and use regular for

too slow. If it was up to me I would throw an exception and then catch it silently.

@krzychu124
Copy link
Member

krzychu124 commented Feb 26, 2020

If it was up to me I would throw an exception and then catch it silently.

That's probably even slower(if you use logging) 😅

@kianzarrin
Copy link
Collaborator Author

kianzarrin commented Feb 26, 2020

@krzychu124 It is slower memory allocation is slow but its not performance critical part of the code. its as a response to user click. your approach occurs every loop.

in any case I know you guys are not going to agree to the exception approach so I found another way to both make the code simpler and solve the problem. Ill upload PR now

I am shocked how did it skipped my attention that I am looking in the wrong place. I was too sleepy and sloppy! zzzzzzz back to 100% now :)

kianzarrin added a commit to kianzarrin/Cities-Skylines-Traffic-Manager-President-Edition that referenced this issue Feb 26, 2020
I return after update to avoid exception.
kianzarrin added a commit that referenced this issue Feb 26, 2020
#744 fixed iteration exception when clicking on handles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Defect detected confirmed Represents confirmed issue or bug VEHICLE RESTRICTIONS Feature: Vehicle restrictions
Projects
None yet
3 participants