Bug 11627 - Auto-Fix of remove redundant base constructor call
Summary: Auto-Fix of remove redundant base constructor call
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: Trunk
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2013-04-05 20:18 UTC by Ciprian Khlud
Modified: 2013-04-06 11:54 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Ciprian Khlud 2013-04-05 20:18:53 UTC
Code like this should remove the base() call:
class BaseClass
{
    public BaseClass()
    {
    }
}
class TestClass : BaseClass
{
    public TestClass(int data) : base() { }
}
should be rewritten like: 
class BaseClass
{
    public BaseClass()
    {
    }
}
class TestClass : BaseClass
{
    public TestClass(int data) 
    { }
}
Comment 2 Mike Krüger 2013-04-06 05:40:19 UTC
Merged - thanks.

btw. do you've resharper ?
Comment 3 Ciprian Khlud 2013-04-06 05:47:09 UTC
Do I R# my code? Yes, I do. I have just one R# issue in my code, namely the namespace is not matching the project location (namespace ICSharpCode.NRefactory.CSharp.Refactoring should be ICSharpCode.NRefactory.CSharp.Refactoring.CodeIssues but this is for a future bug :) when global refactors are easy to be done ). I tried to build MD but I got stuck to see how to compile yet, but this is another story not worth for this bug tracker.

As you've said that R# is sensible with formatting, when I can make some changes and doesn't "hurt" too much, I write parts of code with Notepad++ to not have too many tabs/spaces issues. At last, I fixed EOLN (hopefully) by changing my local .gitattributes to always export LF (with a help of some friend that knows Git).
Comment 4 Mike Krüger 2013-04-06 05:54:02 UTC
R# can disable code issues with

// Resharper disable XXX
...
// Resharper restore XXX

I implemented support for the Resharper disable method. For example:

https://github.com/icsharpcode/NRefactory/blob/master/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantUsingIssue.cs

I flagged the issue with:

 ResharperDisableKeyword = "RedundantUsingDirective"


Tested here:

https://github.com/icsharpcode/NRefactory/blob/master/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantUsingInspectorTests.cs#L140

Unfortunately I don't have resharper atm and it seems that there is no official 'list' with these keywords. It would be nice if you could support the resharper disable/restore mechanism on your issues if possible. (I think it's easy to find out the resharper keyword - they've a command for adding this).