'csharp_style_conditional_delegate_call = true:silent' not honored by RunDefaultCodeCleanup
#38,490 opened on Sep 4, 2019
Repository metrics
- Stars
- (20,414 stars)
- PR merge metrics
- (Avg merge 6d 17h) (256 merged PRs in 30d)
Description
This issue has been moved from a ticket on Developer Community.
When I click on EditorContextMenus.FileHealthIndicator.RunDefultCodeCleanup statements that should be handled by 'csharp_style_conditional_delegate_call = true:silent' are not modified, but the same statements have a light-bulb showing that they can be modified manually.
In the attached screen-shot there is a light-bulb next to one of the statements not being handled - unfortunately the contents of the light-bulb prompt disappears when I switch from VS to this feedback or the 'Snip & Sketch' tool - but the text on the dialog-box is 'IDE1005 Delegate invocation can be simplified' and the simplification shows the null-propagation that will be used.
Attached is my .editorconfig file.
Original Comments
Visual Studio Feedback System on 6/18/2019, 02:00 AM:
Rui Zhang [MSFT] on 6/19/2019, 01:55 AM:
Lee Silver on 6/19/2019, 03:14 PM:
I'm the only developer.The Project is Platform:windows Project Type:Library.I created a dummy Platform:windows Project Type:Console, copied one of the offending files into it and got the same results -- RunDefaultCodeCleanup did not do the expected transform
Rui Zhang [MSFT] on 6/23/2019, 08:10 PM:
Lee Silver on 6/24/2019, 03:44 PM:
Attached are ClassLibrary1.csproj and Class1.cs - you already have the .editorconfig file.Click onEventHandler eh = (EventHandler) Events [UIACanResizeChangedEvent];and you will see a light-bulb offering to simplify the delegate invocation.But run EditorContextMenus.FileHealthIndicator.RunCustomCodeCleanup and you will see that the code-sequence is not transformed when I believe it should be transformed to((EventHandler)Events[UIACanResizeChangedEvent])?.Invoke(this, e);which is what happens when the light-bulb transform is clicked.Note that the int x;statement is changed toInt32 x;showing that RunCustomCodeCleanup ran.
Lee Silver on 7/4/2019, 07:23 PM:
Sorry for the delay - I somehow missed your request for additional info.Attached is test.zip containing a new sample the demonstrates the problem.
Rui Zhang [MSFT] on 6/27/2019, 10:42 PM:
Lee Silver on 7/14/2019, 03:46 PM:
Just checking that you got the zip-file I sent on 7/5.
Rui Zhang [MSFT] on 7/16/2019, 02:47 AM:
Lee Silver on 7/16/2019, 03:03 PM:
No, clicking the light-bulb works just fine.But as I stated when I reported the problem "When I click on EditorContextMenus.FileHealthIndicator.RunDefultCodeCleanup statements that should be handled by ‘csharp_style_conditional_delegate_call = true:silent’ are not modified, but the same statements have a light-bulb showing that they can be modified manually."In other words, I believe the statement with the light-bulb should be rewritten by EditorContextMenus.FileHealthIndicator.RunDefultCodeCleanup because my .editorconfig-file contains ‘csharp_style_conditional_delegate_call = true:silent’, but it isn't. It is only rewritten when done via the light-bulb.
Lee Silver on 7/24/2019, 07:18 PM:
Visual Studio Feedback System on 7/25/2019, 02:40 AM:
Original Solutions
(no solutions)