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
{
}
}
Thanks for the provided code sample. I have reproduced this issue. We will work on fixing it in future updates.