Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Debugging Modules #35

Copy link
Copy link
@markekraus

Description

@markekraus
Issue body actions

Internally we have begun using a module builder that is heavily inspired by this project and tweaked a bit for our environment. One piece of feedback I received was that arranging the code so that classes and functions live in separate files makes debugging harder.

Assuming you were working with a monolithic psm1, It would be possible to debug and refactor within the same file with VS Code. With code living in separate files you have to build the module, set your breakpoints in the compiled psm1, follow the code to its bug, then fix the bug in a similar location in the actual source file.

While tooling for converting source line to compiled line and vice versa is somewhat helpful here, it does make the debugging experience more cumbersome.

I have tried to consider a way in which you can debug and code in the source files, but I'm at a loss. One thing I considered was allowing a Debug Build which would create a psm1 that dot sources the function files. This is doable but would only work for functions because classes have to live in the psm1 to support using each other (class a uses class b and class b uses class a). As I vaguely recall there are other caveats to dot sourcing classes.

Or maybe there is some way to allow for edits in the compiled psm1 to be pushed back to the source file or something.

Anyway, I never ran into this issue because my module coding workflows don't rely heavily on the debugging engine. However, a few of my co-workers do rely on it.

I'm looking for feedback on how we either document debugging modules built from this project or tools to make it much easier.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.