Skip to content

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