Skip to content

Conversation

@KirillOsenkov
Copy link
Member

When a .ruleset file includes a non-existing ruleset reference we receive null from ResolveIncludePath and throw a FileNotFoundException, which is the immediately caught in LoadRuleSet.

We can avoid the first-chance exception and the associated allocations if we just return null. A missing ruleset is not an exceptional situation so no need to use exceptions for control flow here if we can avoid it.

This is not blocking anything and not urgent, I was just passing by and noticed this and decided to fix.

@KirillOsenkov KirillOsenkov requested a review from a team as a code owner April 2, 2019 22:46
@KirillOsenkov KirillOsenkov requested a review from mavasani April 2, 2019 22:47
Copy link
Member

Choose a reason for hiding this comment

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

Is there even a reason to have a separate function here? There appears to be only a single caller.

Copy link
Member

Choose a reason for hiding this comment

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

Agree with the premise of the change. But given there is a single caller think it would be simpler to just inline this changed method. Makes it clearer this has no other impact on the code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I've inlined the method.

@jaredpar
Copy link
Member

jaredpar commented Apr 3, 2019

@dotnet/roslyn-compiler for review

Copy link
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

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

LGTM (iteration 2)

@jcouv jcouv added this to the 16.2 milestone Apr 23, 2019
…not found.

When a .ruleset file includes a non-existing ruleset reference we receive null from ResolveIncludePath and throw a FileNotFoundException, which is the immediately caught in LoadRuleSet.

We can avoid the first-chance exception and the associated allocations if we just return null. A missing ruleset is not an exceptional situation so no need to use exceptions for control flow here if we can avoid it.
@KirillOsenkov
Copy link
Member Author

@mavasani is there a way to reset the integration tests? Wondering if anything else is blocking merging this. Thanks!

@mavasani
Copy link
Contributor

@KirillOsenkov You can manually do a Retry by following the failure links:

image

I have kicked it off for you here.

@KirillOsenkov
Copy link
Member Author

It's green! Who can help merge this?

@333fred
Copy link
Member

333fred commented Jun 20, 2019

@agocke, did you want to take a look at this PR?

@KirillOsenkov
Copy link
Member Author

Let's merge this?

@agocke agocke merged commit fc80bb0 into dotnet:master Jun 27, 2019
@agocke
Copy link
Member

agocke commented Jun 27, 2019

@KirillOsenkov Done, thanks!

@KirillOsenkov KirillOsenkov deleted the dev/kirillo/ruleset branch June 27, 2019 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants