Author Topic: ACAD 2022 CRASH at db.UpdateExt(true);  (Read 1543 times)

0 Members and 1 Guest are viewing this topic.

Bryco

  • Water Moccasin
  • Posts: 1882
ACAD 2022 CRASH at db.UpdateExt(true);
« on: October 05, 2021, 08:21:04 PM »
Code that works on acad 2019 & 2021  is crashing on db.UpdateExt(true);
Has anyone had that problem?

Using vs 2017 community  and references from 2019 objectarx

Bryco

  • Water Moccasin
  • Posts: 1882
Re: ACAD 2022 CRASH at db.UpdateExt(true);
« Reply #1 on: October 12, 2021, 02:04:12 PM »
[CommandMethod("k")]
        public static void tester()
        {
            Document doc = acadApp.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            db.UpdateExt(false);
        }

Crashes on 2022  whether set to false or true.

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: ACAD 2022 CRASH at db.UpdateExt(true);
« Reply #2 on: October 13, 2021, 02:16:18 AM »
Hi,
It works as expected for me, compiled with VS2019 which is the recommended version for A2022, see this topic:
https://help.autodesk.com/view/OARX/2022/ENU/?guid=GUID-450FD531-B6F6-4BAE-9A8C-8230AAC48CB4
Speaking English as a French Frog

Bryco

  • Water Moccasin
  • Posts: 1882
Re: ACAD 2022 CRASH at db.UpdateExt(true);
« Reply #3 on: October 13, 2021, 11:23:18 AM »
Ty Gile,  it's weird that almost everything was working using the 2019 references and 2017vs. I guess it is time to update.

Bryco

  • Water Moccasin
  • Posts: 1882
Re: ACAD 2022 CRASH at db.UpdateExt(true);
« Reply #4 on: October 15, 2021, 05:25:27 PM »
[DllImport("user32.dll")]
 private static extern int GetForegroundWindow();

        [DllImport("user32.dll")]
        private static int GetForegroundWindow();

I think the 32 bit part of the .dll is a problem.  I have used these in a sub to turn caps on when returning to Cad.  When I commented these out both the VS2019 and VS2017 worked without crashing. I guess the forground window is fired when calling db.UpdateExt(false).  Perhaps the crash was a windows crash and so no warning