I maintain an automated project that takes user input, sends that data through some pre-processing then onto a workstation which launches AutoCAD and prepares a drawing. The pre-processing all takes place with a C# project developed in Visual Studio. All has worked well for many months.
Recently a new developer joined the team and his code works in the pre-processing section. As before, we launch AutoCAD from this C# code and then using the SendCommand class we inject a bunch of variables and settings into AutoCAD which LISP programs use to create the drawings. In short, we set OSMODE, PICKBOX to the desired values and that's all cool. But in the past, I was always setting CMDECHO to 0 as well. The new code starts the LISP files which create the drawing and then it (the C# code) closes down the AutoCAD document when it's done. In the past I was using LISP to close the files, but the new method closes the file from C#.
What I started noticing was that there were times when the AutoCAD drawing file was closing down before the drawing was finished. Not a good thing. The new developer told me that his code actually waits until the LISP program is complete before it closes the file. How he is doing this I've not researched yet, but his thinking is that the (setvar 'CMDECHO 0) commands are what is causing this premature shutdown. So to placate the team I set the command for CMDECHO to 1 instead of 0. Well the drawings started finishing but there were some other bugs we fixed at the same time so I cannot be sure this is what fixed it. My limited understanding is that while you can talk to AutoCAD from C#, you can't talk to C# from AutoCAD, especially from LISP. I am not convinced that this setting is what is causing the C# program to wait until the LISP file is finished. The LISP files have no code in them to say "Hey I'm finished!" so is this really what is happening or is it just working as I thought it would from the beginning?