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

Avoid throwing exception when receiving invalid SqlNotificationInfo value #1378

Merged
merged 1 commit into from
Nov 17, 2021
Merged

Avoid throwing exception when receiving invalid SqlNotificationInfo value #1378

merged 1 commit into from
Nov 17, 2021

Conversation

johnnypham
Copy link
Contributor

@johnnypham johnnypham commented Nov 5, 2021

Addresses #1376

When receiving an invalid SqlNotificationInfo value, an exception would be thrown because the call to Enum.Parse fails. We can use Enum.TryParse to avoid this. The result will still be SqlNotificationInfo.Unknown either way.

@johnnypham johnnypham changed the title Avoid throwing exception when receiving invlaid SqlNotificationInfo value Avoid throwing exception when receiving invalid SqlNotificationInfo value Nov 5, 2021
Copy link

@ascott18 ascott18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm after testing that the exception is no longer thrown. The "none" attribute value still comes out as "Unknown" as expected, but without having VS break into an exception when exception settings are all enabled and Just My Code is disabled.

@cheenamalhotra
Copy link
Member

Can you add a test case here to cover this code block?

@johnnypham
Copy link
Contributor Author

Can you add a test case here to cover this code block?

I was unable to reproduce it but this is a server-side bug so it shouldn't be occurring. If it does, we'll avoid throwing an unnecessary exception.

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

Successfully merging this pull request may close these issues.

5 participants