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

Generate_Conceptual_Help: Fails if module script file contain advanced types #121

Open
johlju opened this issue Jul 25, 2022 · 1 comment

Comments

@johlju
Copy link
Member

johlju commented Jul 25, 2022

Details of the scenario you tried and the problem that is occurring

If for example a class-based resource contain a advanced type the task fails to process the conceptual help (this will probably true for Wiki generation as well).

Steps to reproduce the problem

Add the following to the built module script file (.psm1):

class SqlDatabasePermission
{
    hidden [Microsoft.SqlServer.Management.Smo.Server] $sqlServerObject = $null

    # Other code removed for readability
}

Expected behavior

Should be able to handle advanced types that is not loaded.

Current behavior

Throws the error:

ERROR: At C:\source\SqlServerDsc\output\SqlServerDsc\16.0.0\SqlServerDsc.psm1:745 char:13
+     hidden [Microsoft.SqlServer.Management.Smo.Server] $sqlServerObje …
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unable to find type [Microsoft.SqlServer.Management.Smo.Server].
At C:\source\SqlServerDsc\output\RequiredModules\DscResource.DocGenerator\0.11.0\DscResource.DocGenerator.psm1:3085 char:17
+                 throw $parseErrors
+                 ~~~~~~~~~~~~~~~~~~

Suggested solution to the issue

  • Option 1: Replace any advanced types from module script file before parsing. Could be a list of regex in the build configuration that is run on the code before parsing.
  • Option 2: Provide means in the build configuration to load additional stub types or modules necessary to get the correct advanced types into the session.

Personally I prefer option 2.

The operating system the target node is running

n/a

Version and build of PowerShell the target node is running

7.2

Version of the module that was used

0.11.0

@gaelcolas
Copy link
Member

I prefer option 2 as well.

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

2 participants