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

implement "possible InvalidOperationException" analyzer like ReSharper #43

Open
matthargett opened this issue Oct 22, 2016 · 2 comments

Comments

@matthargett
Copy link

In react-native-windows, we recently had a bug that should have been caught by static analysis. Even when updating to the latest prerelease nuget packages, no Roslyn analyzer detected the bug. ReSharper, however, did:
resharper-finding-cast-bug

@sharwell
Copy link
Member

@matthargett Do you have a link to the original bug to provide a bit more context around what is being analyzed/detected?

@matthargett
Copy link
Author

Here's the diff where the bug was fixed:
microsoft/react-native-windows@1ed199c

The non-UWP version of ContentLength could return null(!?), so the cast to ulong would fail. ReSharper warned on the issue in the IDE, but we want to get this feedback in a Roslyn analyzer we can run in our CI for free. Casting potential null to non-nullable value type is one way to generically classify this, but ReSharper identified it as potential InvalidOperationException. Whatever the phrasing, that's the core bug class we'd like to detect and fail the build on. /cc @rozele @kevinvangelder

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

No branches or pull requests

2 participants