[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