gaelcolas / Sampler

Module template with build pipeline and examples, including DSC elements.
MIT License
172 stars 42 forks source link

Unable to build DnsServerDsc in Powershell 7.x - Cannot bind argument to parameter 'Message' because it is null #291

Closed JohnLudlow closed 3 years ago

JohnLudlow commented 3 years ago

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

> .\build.ps1 -Tasks build

....

Generating conceptual help for all DSC resources based on source.
ERROR: Cannot bind argument to parameter 'Message' because it is null.
At C:\src\git\DnsServerDsc\output\RequiredModules\DscResource.DocGenerator\0.8.3\DscResource.DocGenerator.psm1:1681 char:35
+ …       $exampleContent = Get-ResourceExampleAsText -Path $examplesPath
+                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At C:\src\git\DnsServerDsc\output\RequiredModules\DscResource.DocGenerator\0.8.3\tasks\Generate_Conceptual_Help.build.ps1:84 char:1
+ task Generate_Conceptual_Help {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At C:\src\git\DnsServerDsc\build.ps1:290 char:13
+             task $workflow $workflowItem
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build FAILED. 8 tasks, 1 errors, 0 warnings 00:00:09.0787717
Get-ResourceExampleAsText: C:\src\git\DnsServerDsc\output\RequiredModules\DscResource.DocGenerator\0.8.3\DscResource.DocGenerator.psm1:1681

The operating system the target node is running

>     Get-ComputerInfo -Property @(
>>         'OsName',
>>         'OsOperatingSystemSKU',
>>         'OSArchitecture',
>>         'WindowsVersion',
>>         'WindowsBuildLabEx',
>>         'OsLanguage',
>>         'OsMuiLanguages')

OsName               : Microsoft Windows 10 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage           : en-GB
OsMuiLanguages       : {en-GB}

Version and build of PowerShell the target node is running

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.1.3
PSEdition                      Core
GitCommitId                    7.1.3
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

(also reproduced in 7.2.0-preview5, but not in 5.1)

Version of the DSC module that was used ('dev' if using current dev branch)

Current commit on main:

> git show --oneline -s
8f0de03 (HEAD -> main, tag: v3.0.0-preview0004, origin/main, origin/HEAD) DnsServerDsSetting: New Resource to Manage AD DNS settings (#258)
johlju commented 3 years ago

Hmm.. I been working on that module all week and I have not seen build fail. Have you run ./build.ps1 -ResolveDependency -Tasks noop. Also make sure to start in a new session to make sure nothing old is imported into the session.

johlju commented 3 years ago

Can't reproduce this with a newly cloned repo folder:

PS E:\Source\DnsServerDsc> .\build.ps1 -ResolveDependency -Tasks noop
[pre-build] Starting Build Init
[pre-build] Creating required modules directory E:\Source\DnsServerDsc\output\RequiredModules.
[pre-build] Pre-pending 'E:\Source\DnsServerDsc\output\RequiredModules' folder to PSModulePath
[pre-build] Pre-pending 'E:\Source\DnsServerDsc\output' folder to PSModulePath
[pre-build] Resolving dependencies.
[pre-build] Starting bootstrap process.
[build] Starting build with InvokeBuild.
[build] Parsing defined tasks
[build] Loading Configuration from E:\Source\DnsServerDsc\build.yaml
Importing tasks from module Sampler
         Loading Build-Module.ModuleBuilder.build.Sampler.ib.tasks...
         Loading Clean.ModuleBuilder.build.Sampler.ib.tasks...
         Loading DeployAll.PSDeploy.build.Sampler.ib.tasks...
         Loading DscResource.Test.build.Sampler.ib.tasks...
         Loading generateHelp.PlatyPS.build.Sampler.ib.tasks...
         Loading GuestConfig.build.Sampler.ib.tasks...
         Loading Invoke-Pester.pester.build.Sampler.ib.tasks...
         Loading JaCoCo.coverage.build.Sampler.ib.tasks...
         Loading release.module.build.Sampler.ib.tasks...
         Loading Set-BuildEnvironment.BuildHelpers.build.Sampler.ib.tasks...
         Loading Set-SamplerTaskVariable...
Importing tasks from module DscResource.DocGenerator
         Loading Task.Generate_Conceptual_Help...
         Loading Task.Generate_Wiki_Content...
         Loading Task.Publish_GitHub_Wiki_Content...
Importing tasks from module Sampler.GitHubTasks
         Loading New-Release.GitHub.build.Sampler.GitHubTasks.ib.tasks...
Adding Workflow from configuration:
  +-> test
  +-> publish
  +-> build
  +-> hqrmtest
  +-> .
  +-> pack
[build] Executing requested workflow: noop
Build noop E:\Source\DnsServerDsc\build.ps1
Redefined task '.'.

===============================================================================
                        NOOP
Empty task, useful to test the bootstrap process.
-------------------------------------------------------------------------------
  /noop
  E:\Source\DnsServerDsc\build.ps1:267

Done /noop 00:00:00.0593891
Build succeeded. 1 tasks, 0 errors, 0 warnings 00:00:05.9627921
PS E:\Source\DnsServerDsc> git show --oneline -s
8f0de03 (HEAD -> main, tag: v3.0.0-preview0004, origin/main, origin/HEAD) DnsServerDsSetting: New Resource to Manage AD DNS settings (#258)
PS E:\Source\DnsServerDsc> .\build.ps1 -Tasks build
[pre-build] Starting Build Init
[build] Starting build with InvokeBuild.
[build] Parsing defined tasks
[build] Loading Configuration from E:\Source\DnsServerDsc\build.yaml
Importing tasks from module Sampler
         Loading Build-Module.ModuleBuilder.build.Sampler.ib.tasks...
         Loading Clean.ModuleBuilder.build.Sampler.ib.tasks...
         Loading DeployAll.PSDeploy.build.Sampler.ib.tasks...
         Loading DscResource.Test.build.Sampler.ib.tasks...
         Loading generateHelp.PlatyPS.build.Sampler.ib.tasks...
         Loading GuestConfig.build.Sampler.ib.tasks...
         Loading Invoke-Pester.pester.build.Sampler.ib.tasks...
         Loading JaCoCo.coverage.build.Sampler.ib.tasks...
         Loading release.module.build.Sampler.ib.tasks...
         Loading Set-BuildEnvironment.BuildHelpers.build.Sampler.ib.tasks...
         Loading Set-SamplerTaskVariable...
Importing tasks from module DscResource.DocGenerator
         Loading Task.Generate_Conceptual_Help...
         Loading Task.Generate_Wiki_Content...
         Loading Task.Publish_GitHub_Wiki_Content...
Importing tasks from module Sampler.GitHubTasks
         Loading New-Release.GitHub.build.Sampler.GitHubTasks.ib.tasks...
Adding Workflow from configuration:
  +-> test
  +-> publish
  +-> build
  +-> hqrmtest
  +-> .
  +-> pack
[build] Executing requested workflow: build
Build build E:\Source\DnsServerDsc\build.ps1
Redefined task '.'.

===============================================================================
                        CLEAN
Deleting the content of the Build Output folder, except ./modules
-------------------------------------------------------------------------------
  /build/Clean
  E:\Source\DnsServerDsc\output\RequiredModules\Sampler\0.111.1\tasks\Clean.ModuleBuilder.build.ps1:16

Removing E:\Source\DnsServerDsc\output\* excluding RequiredModules
Done /build/Clean 00:00:00.0310289

===============================================================================
                        BUILD MODULEOUTPUT MODULEBUILDER
Build the Module based on its Build.psd1 definition
-------------------------------------------------------------------------------
  /build/Build_Module_ModuleBuilder/Build_ModuleOutput_ModuleBuilder
  E:\Source\DnsServerDsc\output\RequiredModules\Sampler\0.111.1\tasks\Build-Module.ModuleBuilder.build.ps1:41

        Project Name               = 'DnsServerDsc'
        Source Path                = 'E:\Source\DnsServerDsc\source'
        Output Directory           = 'E:\Source\DnsServerDsc\output'
        Built Module Subdirectory  = 'E:\Source\DnsServerDsc\output\'
        Module Manifest Path (src) = 'E:\Source\DnsServerDsc\source\DnsServerDsc.psd1'
        Module Version             = '3.0.0-preview0004'
        Release Notes path         = 'E:\Source\DnsServerDsc\output\ReleaseNotes.md'

Adding OutputDirectory with value E:\Source\DnsServerDsc\output from current Variables
Adding VersionedOutputDirectory with value True from current Variables
Adding CopyPaths with value en-US DSCResources Modules from Build Info
Adding Encoding with value UTF8 from Build Info
Adding Prefix with value prefix.ps1 from Build Info
Building Module to E:\Source\DnsServerDsc\output\DnsServerDsc...
Done /build/Build_Module_ModuleBuilder/Build_ModuleOutput_ModuleBuilder 00:00:08.5740526

===============================================================================
                        BUILD DSCRESOURCESTOEXPORT MODULEBUILDER

-------------------------------------------------------------------------------
  /build/Build_Module_ModuleBuilder/Build_DscResourcesToExport_ModuleBuilder
  E:\Source\DnsServerDsc\output\RequiredModules\Sampler\0.111.1\tasks\Build-Module.ModuleBuilder.build.ps1:327

        Project Name               = 'DnsServerDsc'
        Source Path                = 'E:\Source\DnsServerDsc\source'
        Output Directory           = 'E:\Source\DnsServerDsc\output'
        Built Module Subdirectory  = 'E:\Source\DnsServerDsc\output\'
        Module Manifest Path (src) = 'E:\Source\DnsServerDsc\source\DnsServerDsc.psd1'
        Versioned Output Directory = 'True'
        Built Module Manifest      = 'E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0\DnsServerDsc.psd1'
        Built Module Base          = 'E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0'
        Module Version             = '3.0.0-preview0004'
        Module Version Folder      = '3.0.0'
        Pre-release Tag            = 'preview0004'
        Built Module Root Script   = 'E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0\DnsServerDsc.psm1'
        Release Notes path         = 'E:\Source\DnsServerDsc\output\ReleaseNotes.md'

        Built DSC Resource Path  = 'E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0\DSCResources'
Looking in E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0\DnsServerDsc.psm1
  Adding DnsRecordCname,DnsRecordPtr,DnsRecordA,DnsRecordAaaa,DnsRecordCnameScoped,DnsRecordMx,DnsRecordNs,DnsRecordSrv,DnsServerCache,DnsServerDsSetting,DnsServerEDns,DnsServerRecursion,DnsServerScavenging,DnsRecordAaaaScoped,DnsRecordAScoped,DnsRecordMxScoped,DnsRecordNsScoped,DnsRecordSrvScoped to the list of DscResource will be write in module manifest.
Looking in E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0\DSCResources
  Adding DnsServerADZone,DnsServerClientSubnet,DnsServerConditionalForwarder,DnsServerDiagnostics,DnsServerForwarder,DnsServerPrimaryZone,DnsServerRootHint,DnsServerSecondaryZone,DnsServerSetting,DnsServerZoneAging,DnsServerZoneScope,DnsServerZoneTransfer to the list of DscResource will be write in module manifest.
Updating the Module Manifest's DscResourcesToExport key...
  Adding DnsRecordCname, DnsRecordPtr, DnsRecordA, DnsRecordAaaa, DnsRecordCnameScoped, DnsRecordMx, DnsRecordNs, DnsRecordSrv, DnsServerCache, DnsServerDsSetting, DnsServerEDns, DnsServerRecursion, DnsServerScavenging, DnsRecordAaaaScoped, DnsRecordAScoped, DnsRecordMxScoped, DnsRecordNsScoped, DnsRecordSrvScoped, DnsServerADZone, DnsServerClientSubnet, DnsServerConditionalForwarder, DnsServerDiagnostics, DnsServerForwarder, DnsServerPrimaryZone, DnsServerRootHint, DnsServerSecondaryZone, DnsServerSetting, DnsServerZoneAging, DnsServerZoneScope, DnsServerZoneTransfer to Module Manifest E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0\DnsServerDsc.psd1
Done /build/Build_Module_ModuleBuilder/Build_DscResourcesToExport_ModuleBuilder 00:00:00.8984934
Done /build/Build_Module_ModuleBuilder 00:00:09.5051809

===============================================================================
                        BUILD NESTEDMODULES MODULEBUILDER

-------------------------------------------------------------------------------
  /build/Build_NestedModules_ModuleBuilder
  E:\Source\DnsServerDsc\output\RequiredModules\Sampler\0.111.1\tasks\Build-Module.ModuleBuilder.build.ps1:129

        Project Name               = 'DnsServerDsc'
        Source Path                = 'E:\Source\DnsServerDsc\source'
        Output Directory           = 'E:\Source\DnsServerDsc\output'
        Built Module Subdirectory  = 'E:\Source\DnsServerDsc\output\'
        Module Manifest Path (src) = 'E:\Source\DnsServerDsc\source\DnsServerDsc.psd1'
        Versioned Output Directory = 'True'
        Built Module Manifest      = 'E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0\DnsServerDsc.psd1'
        Built Module Base          = 'E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0'
        Module Version             = '3.0.0-preview0004'
        Module Version Folder      = '3.0.0'
        Pre-release Tag            = 'preview0004'
        Built Module Root Script   = 'E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0\DnsServerDsc.psm1'
        Release Notes path         = 'E:\Source\DnsServerDsc\output\ReleaseNotes.md'

Copying Nested Module files for DscResource.Common
    Default param Recurse is 'True'
    Default param Destination is '$builtModuleBase/Modules/$nestedModuleName'
    Removing Parameter AddToManifest for Copy-Item
    The Path is: '.\output\RequiredModules\DscResource.Common\*'
    Removing Parameter CopyOnly for Copy-Item
    Resolving Absolute path for Destination $builtModuleBase/Modules/$nestedModuleName
    The Destination is: E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0\Modules\DscResource.Common
Copy DscResource.Common...
Done

Done /build/Build_NestedModules_ModuleBuilder 00:00:00.1457544

===============================================================================
                        CREATE CHANGELOG RELEASE OUTPUT
Create ReleaseNotes from changelog and update the Changelog for release
-------------------------------------------------------------------------------
  /build/Create_changelog_release_output
  E:\Source\DnsServerDsc\output\RequiredModules\Sampler\0.111.1\tasks\release.module.build.ps1:41

        Project Name               = 'DnsServerDsc'
        Source Path                = 'E:\Source\DnsServerDsc\source'
        Output Directory           = 'E:\Source\DnsServerDsc\output'
        Built Module Subdirectory  = 'E:\Source\DnsServerDsc\output\'
        Module Manifest Path (src) = 'E:\Source\DnsServerDsc\source\DnsServerDsc.psd1'
        Versioned Output Directory = 'True'
        Built Module Manifest      = 'E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0\DnsServerDsc.psd1'
        Built Module Base          = 'E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0'
        Module Version             = '3.0.0-preview0004'
        Module Version Folder      = '3.0.0'
        Pre-release Tag            = 'preview0004'
        Built Module Root Script   = 'E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0\DnsServerDsc.psm1'
        Release Notes path         = 'E:\Source\DnsServerDsc\output\ReleaseNotes.md'

        ChangeLogOutputPath   = 'E:\Source\DnsServerDsc\output\CHANGELOG.md'
Built Manifest E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0\DnsServerDsc.psd1
Done /build/Create_changelog_release_output 00:00:00.3190768

===============================================================================
                        GENERATE CONCEPTUAL HELP
This task generates conceptual help for DSC resources.
-------------------------------------------------------------------------------
  /build/Generate_Conceptual_Help
  E:\Source\DnsServerDsc\output\RequiredModules\DscResource.DocGenerator\0.8.3\tasks\Generate_Conceptual_Help.build.ps1:84

        OutputDirectory       = 'E:\Source\DnsServerDsc\output'
        Built Module Manifest = 'E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0\DnsServerDsc.psd1'
        Built Module Base     = 'E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0'
        Module Version                = '3.0.0-preview0004'
        Module Version Folder         = '3.0.0'
        Pre-release Tag               = 'preview0004'
        Project Path                  = E:\Source\DnsServerDsc
        Project Name                  = DnsServerDsc
        Source Path                   = E:\Source\DnsServerDsc\source
        Built Module Base             = E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0
        MarkdownCodeRegularExpression = RegEx: \`(.+?)\` | RegEx: \\(\\) | RegEx: \[[^\[]+\]\((.+?)\) | RegEx: _(.+?)_ | RegEx: \*\*(.+?)\*\* | RegEx: \*(.+?)\*
Generating conceptual help for all DSC resources based on source.
WARNING: No Example files found.
Done /build/Generate_Conceptual_Help 00:00:03.1676417

===============================================================================
                        GENERATE WIKI CONTENT
This task generates wiki documentation for the DSC resources.
-------------------------------------------------------------------------------
  /build/Generate_Wiki_Content
  E:\Source\DnsServerDsc\output\RequiredModules\DscResource.DocGenerator\0.8.3\tasks\Generate_Wiki_Content.build.ps1:87

        OutputDirectory       = 'E:\Source\DnsServerDsc\output'
        Built Module Manifest         = 'E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0\DnsServerDsc.psd1'
        Built Module Base             = 'E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0'
        Module Version                = '3.0.0-preview0004'
        Module Version Folder         = '3.0.0'
        Pre-release Tag               = 'preview0004'
        Project Path                  = E:\Source\DnsServerDsc
        Project Name                  = DnsServerDsc
        Source Path                   = E:\Source\DnsServerDsc\source
        Built Module Base             = E:\Source\DnsServerDsc\output\DnsServerDsc\3.0.0
        Wiki Output Path             = E:\Source\DnsServerDsc\output\WikiContent
        Wiki Source Path        = E:\Source\DnsServerDsc\source\WikiSource
Generating Wiki content for all DSC resources based on source and built module.
WARNING: No Example files found.
Copying Wiki content from the Wiki source folder.
Updating module version in Home.md if there are any placeholders found.
Done /build/Generate_Wiki_Content 00:00:01.9651852
Done /build 00:00:15.1516513
Build succeeded. 9 tasks, 0 errors, 0 warnings 00:00:17.4805419
PS E:\Source\DnsServerDsc>
JohnLudlow commented 3 years ago

I hadn't tried -ResolveDependency -Tasks noop. Just tried it now on a fresh session and newly cloned repo and it worked (not surprising), but -Tasks build still failed.

noop.log build.log

Could you confirm what version of PowerShell you were using? I've seen it succeed in 5.1.

JohnLudlow commented 3 years ago

@gaelcolas @johlju has there been any further progress on this? Did you guys get a chance to look at the logs I posted?

Thanks

gaelcolas commented 3 years ago

Nope but I can now. 1 sec (let's chat on slack/discord DSC channel)

JohnLudlow commented 3 years ago

Sure - I'm in the #DSC discord channel

gaelcolas commented 3 years ago

Ok, yes I have the same issue, which is with DscResource.DocGenerator v0.8.3.

In the meantime you can "disable" the documentation task by commenting out the line in build.yaml (line 37-38):

    # - Generate_Conceptual_Help
    # - Generate_Wiki_Content

This will let you work while we fix DscResource.DocGenerator (/cc @johlju)

JohnLudlow commented 3 years ago

Ok thanks I'll give that a try and let you know

johlju commented 3 years ago

I opened the issue https://github.com/dsccommunity/DscResource.Common/issues/74 to track this. Closing this issue since it cannot be resolved in Sampler.