Bug Report T347308
Visible to All Users

Move Type To File incorrectly processes using statements controlled by the compile directive

created 9 years ago

It seems that if code file has a using statement controlled by compile directive, the command errors out.  If I comment out the directive code and leave just the currently active using statement command works correctly.

Trying to move the PropulateCommand class into its own file.

Attaching the Visual Studio Activity Log file in case it helps.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

#if CORE
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Core.Application;
#else
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
#endif
using AcAp = Autodesk.AutoCAD.ApplicationServices;
using AcCm = Autodesk.AutoCAD.Colors;
using AcDb = Autodesk.AutoCAD.DatabaseServices;
using AcEd = Autodesk.AutoCAD.EditorInput;
using AcGe = Autodesk.AutoCAD.Geometry;
using AcGi = Autodesk.AutoCAD.GraphicsInterface;
using AcLy = Autodesk.AutoCAD.LayerManager;
using AcPl = Autodesk.AutoCAD.PlottingServices;
using AcRx = Autodesk.AutoCAD.Runtime;
using AcWi = Autodesk.AutoCAD.Windows;

namespace Ams.Propulate
{

public class Commands
    {
        [AcRx.CommandMethod("AMS1_Propulate")]
        public void Propulate()
        {
            try
            {
                var database = AcDb.HostApplicationServices.WorkingDatabase;
                using (AcDb.Transaction transaction = database.TransactionManager.StartTransaction())
                {
                    PropulateCommand command = new PropulateCommand(database, transaction, @"C:\Code\Ams.Propulate\Ams.Propulate.Tests\IniFiles\Good.prp");
                    command.UpdateDocumentProperties();

transaction.Commit();
                }
            }
            catch (Exception ex)
            {
                AcadApp.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\n" + ex.ToString());
            }
        }
    }

public class PropulateCommand
    {
    }
}

Comments (1)
DevExpress Support Team 9 years ago

    Thanks for the provided code sample. I have reproduced this issue. We will work on fixing it in future updates.

    Answers approved by DevExpress Support

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