-
Notifications
You must be signed in to change notification settings - Fork 778
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
Remove Environment.Exit #163
base: master
Are you sure you want to change the base?
Conversation
oops - I should read existing PR's first :o |
key = Helpers.StringToByteArray(arguments["/keyhex"]); | ||
try | ||
{ | ||
key = Helpers.StringToByteArray(arguments["/keyhex"]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of putting the try/catch around the single function call, would it not be cleaner to have a higher level try block in Main for ArgumentException?
{ | ||
try | ||
{ | ||
hashBytes = Helpers.StringToByteArray(hash); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous comments regarding propagating the exception and catching higher up in Main
{ | ||
try | ||
{ | ||
hashBytes = Helpers.StringToByteArray(hash); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above
Thanks for the PR an sorry for the delay. Finally had some time to look at this. I've added some comments to the PR. I think throwing an |
When running from something like 'execute-assembly', Environment.Exit can be problematic.
In my code I had something like the following in place: https://www.mdsec.co.uk/2020/08/massaging-your-clr-preventing-environment-exit-in-in-process-net-assemblies/
But you can imagine that when Environment.Exit is used to break an infinite loop, this will get interesting 😄 In this case the monitor action became an infinite loop until negative time remaining gave exceptions.
There are some more uses of Environment.Exit() but they seem less problematic (need to be careful with correct parameters though).