Current filter:
                                You should refresh the page.
                                  • Hello,

                                    I have a bunch of constants declared, and given a value but they are never used. Is there a way that CodeRush can delete all of these? I am having no luck with all of the options in the code cleanup for VB.NET. Thanks.

                                    Here is an example of my code

                                    [VB.NET]
                                    Const procName As String = "my name"

                                    Visual Studio even notices these and flags them as a Warning since they are unused local constant.s

                                2 Solutions

                                Creation Date Importance Sort by

                                Fixed:

                                • DevExpress Support Team 05.30.2019

                                  We have published the requested patched build and are looking forward to hearing about your results. Meanwhile, we would like to mark this ticket as Public, if you do not mind, to include it in the What's New lists for future maintenance updates.

                                Hi Michelle,

                                To accomplish your task I suggest you take advantage of the Remove unused members Code Cleanup rule which detects private members with no references and applies the Remove unused member refactoring to them:

                                Note please, that this rule matches not only constants, but also fields, properties, methods, etc.
                                Enable it on the CodeRush | Options | Editor | Visual Basic | Code Cleanup option page, then apply Code Cleanup for any document which contains unused private members using the Ctrl+. shortcut.
                                I have recorded this video to illustrate the process.

                                Additionally, Code Cleanup can be applied at a project or a solution level using the context menu in Visual Studio Solution Explorer tool window.

                                Please keep in mind the changes of solution or project level cleanup will reflect in Visual Studio`s Undo only when a document is open.

                                Please let me know whether or not this addresses your issue.

                                • Michelle Baldwin 05.28.2019

                                  This does not work when the constant is declared inside of a private sub. For example.

                                  [VB.NET]
                                  Public Sub RecordAuditString() Const procName As String = "clsAuditTrail.RecordAuditString" End Sub

                                  Visual studio has it marked as an unused local constant but CodeRush does not clean this up. Is there another setting I am overlooking?

                                • Igor K. (DevExpress) 05.28.2019

                                  Hi Michelle,

                                  Thank you for letting us know about the issue.
                                  I have managed to reproduce this behavior locally. Please give us some time to research it in greater detail.

                                  We will update this ticket once we have any news.