Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hecon5 opened this issue Sep 14, 2022 · 2 comments

Comments

@hecon5
Copy link
Contributor

hecon5 commented Sep 14, 2022

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?

@joyfullservice
Copy link
Owner

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.

@bclothier
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants