Bug Report T600221
Visible to All Users

Code Cleanup - The "Remove unused variable" code cleanup removes the variable used within the collection initializer

created 7 years ago (modified 7 years ago)

When I click on "Runs cleanup foractive document", coderush perform wrong action: it delete a portion of code that is in use. In attached code, CR removes submit and submitGen.

C#
var submit = new UICommand() { Caption = "Crea offerta", Command = new DelegateCommand( () => { IList<InvalidValue> iv = null; IList<InvalidValue> iv1 = null; var item = vm.CurrentItem as OffertaClienteCommerciale; iv = _repository.Save(item); if (iv != null && iv.Any()) { DefaultWinUIMessageBoxService.Show(iv.GetValidazioneAsString(), ((BaseApplication)Application.Current).EnvAppTitle, MessageBoxButton.OK, MessageBoxImage.Error); } else { var notification = DefaultNotificationService .CreatePredefinedNotification(@"Salvataggio effettuato con successo", null, null, null); notification.ShowAsync(); } }, () => { return vm.CanSave; }) }; var submitGen = new UICommand() { Caption = "Crea offerta e genera documento", Command = new DelegateCommand( () => { IList<InvalidValue> iv = null; IList<InvalidValue> iv1 = null; var item = vm.CurrentItem as OffertaClienteCommerciale; iv = _repository.Save(item); if (iv != null && iv.Any()) { DefaultWinUIMessageBoxService.Show(iv.GetValidazioneAsString(), ((BaseApplication)Application.Current).EnvAppTitle, MessageBoxButton.OK, MessageBoxImage.Error); } else { var notification = DefaultNotificationService .CreatePredefinedNotification(@"Salvataggio effettuato con successo", null, null, null); notification.ShowAsync(); } GenerateDoc(item, IsForEdigit); }, () => { return vm.CanSave; }) }; EditOffertaClienteCommercialeSvc.ShowDialog(new List<UICommand> { submit, submitGen }, "Nuova offerta", vm);
Comments (1)
DevExpress Support Team 7 years ago

    Hi Pasquale,

    Thank you for letting us know about this problem.
    I have reproduced this behavior locally. You'll be notified when we prepare a fix.

    Answers approved by DevExpress Support

    created 7 years ago

    We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

    Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

      Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

      Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.