PSDesiredStateConfiguration icon indicating copy to clipboard operation
PSDesiredStateConfiguration copied to clipboard

Get-DscResource doesn't identify the class based DSC resource

Open bagajjal opened this issue 3 years ago • 3 comments

Prerequisites

Steps to reproduce

Get-DscResource doesn't show class-based DSC resources if the PSD1 has all of these CmdletsToExport, FunctionsToExport, AliasesToExport. To mitigate the issues, one of them has to be commented. This is a bug introduced during the PowerShell performance related changes. Andrew Menagarishvili has looked into the code and confirmed this bug.

Expected behavior

Get-DscResources should return DSC resources

Actual behavior

Get-DscResource doesn't show the DSC resource

Error details

No error.

Environment data

Observed with OpenSSH V7.1+.

Visuals

Get-DSCResource doesn't show the class-based DSC resource

image

With workaround by commenting functionsToExport, Get-DscResource shows the class-based DSC Resource

image

bagajjal avatar Jan 14 '22 19:01 bagajjal

Possible temporary workarounds until the bug is fixed:

  1. comment out any of CmdletsToExport / FunctionsToExport / AliasesToExport (for example, it it is an empty array)
  2. specify a wildcard for any of CmdletsToExport / FunctionsToExport / AliasesToExport

anmenaga avatar Mar 08 '22 21:03 anmenaga

I have just experiences the issue and it took some time to find out what it was caused by that bug. Are there plans to fix it?

raandree avatar Apr 21 '23 14:04 raandree

Related/Duplicate https://github.com/PowerShell/PSDesiredStateConfiguration/issues/101

ThomasNieto avatar Jul 31 '23 21:07 ThomasNieto