[DevExpress Support Team: CLONED FROM T411203: Using custom plugins with the roslyn version]
I've just installed the September patch to VS2015 update 3, and code cleanup is no long converting the properties mentioned above to auto-implemented
So lets say you have a class like this one:
Visual BasicPublic Class CRTest
Public Property ExemptionCertificate As String
Get
Throw New NotImplementedException()
End Get
Set(value As String)
Throw New NotImplementedException()
End Set
End Property
End Class
Convert to auto-implemented is enabled in code cleanup, but it doesn't do anything with the property in the above example. A regular property with a backing variable is correctly transformed. If I explicitly invoke the convert to auto implemented property refactoring on it then it does work, but since my prime use for this is to fix a bunch of properties created when implementing an interface, this would be a tedious way to handle it.
Also relevant, I suspect: If I add the single backed property I described above, and invoke the refactoring menu, I don't get the "all" variant of the refactoring. If add a second backed property and invoke the menu I *do* get the "all" variant. Looks like the NotImplementedException properties are now being excluded from whatever filter you are applying to detect if there are single or multiple candidate properties
Hello Kevin,
Thank you for pointing out this issue. You will be immediately notified once we fix it.
As a workaround, I suggest you download the attached file and put it to the
%AppData%…\Roaming\CodeRush\Settings\Public\Editor\Refactoring\
folder.
Please let us know if this does not help.
Thank you, that's done the trick
You are welcome.
Just my opinion,
There should probably be a separate option for converting non-implemented properties. Another reason to have code like this is if you have not implemented the property yet; the exception is a reminder that something still needs to be done.
Hi John,
Thank you for your feedback. We have added a separate checkbox for this option. It will be available with the next release and in the requested hotfix build. We will be able to publish the hotfix soon.
I see the workaround for this (Convert to Auto-implemented property.xml) has stopped working in the latest release 16.1.8. Did you introduce a checkbox to control it, as mentioned above? If so (hopefully), can you let me know where to find it, as I used this a lot!
Hmm, I think I found it, but I'm not sure it's working - check out this screencast: http://screencast.com/t/2CsYeodnU
I've enabled "Allow converting non-implemented properties to auto-implemented ones" on the Editor\All Languages\Code Actions\Code Actions Settings page, but it's only offering me the refactoring for the selected property, and not giving me the convert all variant?
Kevin,
I am concerned to hear that it is not available for you, however I have tried to reproduce this and it works as expected on my machine.
Please see the following image:
Maybe there are some other options that prevent its availability.
Please export CodeRush for Roslyn settings and send them to us for investigation.
To do this, click "CodeRush\Support\Import and Export Settings…", then select "Export CodeRush for Roslyn settings" and follow the wizard steps.
Hi Alex,
Your screenshot is showing properties with backing fields. I'm specifically referring to unimplemented properties - see my screencast to see what I mean. I have attached my settings anyway, in case there is a conflict in them
Kev
Here is a test interface/class that exhibits the problem. The class properties were autogenerated to implement the interface, and I would like to use the refactoring to convert them all to auto-implemented properties. Since the latest update, this is no longer possible, I can only do them one at a time:
Imports ClassLibrary1 Public Interface ITest Property Name As String Property Address As String End Interface Public Class Class1 Implements ITest Public Property Address As String Implements ITest.Address Get Throw New NotImplementedException() End Get Set(value As String) Throw New NotImplementedException() End Set End Property Public Property Name As String Implements ITest.Name Get Throw New NotImplementedException() End Get Set(value As String) Throw New NotImplementedException() End Set End Property End Class
Kevin,
Thank you for the sample code provided, I have reproduced this issue and passed it to our developers to address.