msaccess-vcs-addin icon indicating copy to clipboard operation
msaccess-vcs-addin copied to clipboard

Export source from Ribbon: frmVCSMain does not stay open if ErrorLevel > eelWarning (AutoClose)

Open josef-poetzl opened this issue 1 year ago • 2 comments

When Export Source is started from the ribbon, the main form does not remain open despite an error message. AutoClose is always triggered.

Cause: Log.ErrorLevel is always 0, as the log instance in the export methods is destroyed. see: https://github.com/josef-poetzl/msaccess-vcs-addin/commit/6cdb15bf3e9f37fb993dc8c74dce2cd0a5453ed9

Fix: https://github.com/josef-poetzl/msaccess-vcs-addin/commit/36948e5f551e2db6dc250b4c08aad7d05e3e922c

josef-poetzl avatar Mar 13 '24 22:03 josef-poetzl

@josef-poetzl - Thanks for pointing this out! I like the concepts you implemented in the suggested fix. But as I dug into it a little deeper, I think I found an underlying issue that may solve this in an even more elegant way.

As you pointed out the Log instance is destroyed by the call to ReleaseObjects. Stepping through the code, this actually happens twice, once as the export finishes, and a second time as the clsVersionControl class is terminated.

Ideally, I would like to persist the log object during the duration of the entire operation triggered by the ribbon button click. This will allow the form UI code to check the Log.ErrorLevel after the conclusion of the export, but before the form is closed. When the clsVersionControl class terminates at the conclusion of the entire operation, the objects are released. I believe that by removing the redundant (early) calls to ReleaseObjects, we can resolve this issue.

joyfullservice avatar Mar 20 '24 16:03 joyfullservice

Tested: works fine

I still made this adjustment: https://github.com/josef-poetzl/msaccess-vcs-addin/commit/ea1a37e620130a5a55728f0fe6a572a84cc749b3 => to allow add enum items between Warning and Error Note: This is a test branch where I test the interface for AccUnit - with minimal customization of the msaccess-vcs-addin. (see: https://github.com/joyfullservice/msaccess-vcs-addin/discussions/493)

Screenshot of example log: https://www.access-programmers.co.uk/forums/attachments/msaccess-vcs-testfailedwarning-png.113036/

josef-poetzl avatar Mar 20 '24 17:03 josef-poetzl

If this is working @josef-poetzl, can you close it? Thank you!

hecon5 avatar Jun 26 '24 11:06 hecon5