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

"Simplify to base name" should have heuristics to know when not to fire #11820

Closed
ljw1004 opened this issue Jun 7, 2016 · 1 comment
Closed

Comments

@ljw1004
Copy link
Contributor

ljw1004 commented Jun 7, 2016

Version Used: VS2015 Update 2

Steps to Reproduce:

  1. File>New>C#>Universal>Blank
  2. Inside MainPage.cs constructor, write App.Current.Exit();

Expected Behavior:

The idiom App.Current is standard and correct. I don't want to see any greyed-out text on this line, nor any lightbulbs.

Actual Behavior:

It suggests to change my code to Application.Current.Exit();

DISCUSSION

This idiom App.Current is the correct way for folks to write XAML applications. We should not be shipping with an out-of-the-box analyzer that suggests something other than best practice in this common case.

I think it's fine for our in-the-box style analyzers to have heuristics and knowledge of common idioms in common libraries. And this one is about as common as it gets!

I think the suggestion "you can just disable the Simplify-To-Base suggestion in the options dialog" isn't good enough because users shouldn't have to do extra manual tweaking for a common scenario, and besides most users won't even know that feature exists (once it's introduced in Dev15).

@CyrusNajmabadi
Copy link
Member

I don't repro this anymore. Likely fixed at some point when this feature was rewritten.

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

7 participants