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

BUG: If user adds file into /modules manually with wrong VB_Name, build will crash

Open hecon5 opened this issue 3 years ago • 2 comments
trafficstars

If a user puts an outside module (not built with the addin) into the modules subfolder, and the Attribute VB_Name is not the same as the file (or is missing in some odd cases), the build will fail.

Example:

  • User adds new module modSomething.bas into /modules/
  • Module has the `Attribute VB_Name = "modSomeThingElse"
  • User then builds.
  • Build will fail with Error 2489: "The Object 'modSomething' is not open within IDbComponent_Import

I'm not sure how best to deal with this; as fixing it would require parsing the header name and detecting a difference; we could add Catch(2489) to ask the user which name to use?

hecon5 avatar Sep 14 '22 16:09 hecon5

That is an interesting scenario to consider. The average user may not realize that they can't simply rename the file and expect it to work in the build process. I do like the idea of trapping the error and providing them with an error message that clarifies how they need to fix it. It wouldn't be too hard to read the first few lines of the file and verify that the name matches before importing.

In my opinion, the user needs to make the decision on which name needs to be corrected, and we should leave that responsibility to them to prepare files in the proper format for importing.

joyfullservice avatar Sep 16 '22 14:09 joyfullservice

I want to call out one subtle bug from mismatching file names. Git is case-sensitive while Windows isn't, which will then cause weird mismatches. For example, modCOMAddin aka modComAddin will not be handled correctly which can result in losing changes. We should definitely throw a warning if the lettercasing do not match.

bclothier avatar May 20 '23 16:05 bclothier