Bug Report T749362
Visible to All Users

Code Cleanup – “Cleanup on Save” removes necessary namespace references when ORMDataModel generates template classes

created 6 years ago

Hi

Steps to reproduce:

  1. Create a new asp net core web application , and select api template on next stage.
  2. Save project once created and then add DevExpress.xpo nuget package to project, save and build.
  3. Add new data model fill out wizard to create a new database. Save.

ConnectionHelper.cs, JsonSerializationContractResolver.cs and ServiceCollectionExtensions.cs all lack the necessary dx using statements to compile.

Any time you add to the model and save these are regenerated minus the using statements.

Dom

Show previous comments (5)

    Hi Anatol, Uriah

    I have two other machines configured with Visual Studio 2019 and DX 19.1.  Both exhibited exactly the same behaviour.

    Given that you have been unable to recreate this, it seems reasonable to assume that this is something very specific to my setup, so I spent some time going through everything and particularly extensions to see what was causing this issue.

    I gradually removed each extension one by one , rebooting the machine between each action and reran the wizard in each case doing exactly the same as displayed in the clip I linked to in the original post.  In each case I got the same result .  I was eventually left just with CodeRush (the very first thing I Install after VS installation and to which I have applied settings configured in dropbox so that any changed I make within code , or templates that I create apply to all my machines.

    Once Code rush was gone the problem went as well, and it went across all machines, indicating that one aspect of the code rush setup was to blame.

    This I tracked down to CodeCleanup and specifically to having 'Remove Unused usings' checked.

    Personally I think that this is a bug in coderush.  It is stripping everything bar Using System from the files created by the data model designer when you invoke save, yet clearly those usings pertaining to XPO are anything but unused.

    At least now we know what the cause was.

    Dom

    DevExpress Support Team 6 years ago

      Thank you, Dom! We will research this issue further.

      DevExpress Support Team 6 years ago

        Hi Dom,

        I have reproduced this issue locally. We will research it and inform you about our progress.

        Answers approved by DevExpress Support

        created 6 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.