Skip to content

PS Adapter export will hang #792

@ThomasNieto

Description

@ThomasNieto

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Summary

There are times where running export where it will hang. During testing I added debug code to the export method and it is not stuck in my code.

To validate my code you can run the following. In my test it took 2 seconds to return 235 instances of the resource.

using module AnyPackageDsc
[Package]::Export()

Steps to reproduce

Take updated DSC module from anypackage/dsc#24 and then try the following commands

Install-PSResource AnyPackage.PSResourceGet,

dsc resource list --adapter Microsoft.DSC/PowerShell

Type                   Kind      Version  Capabilities  RequireAdapter            Description
-----------------------------------------------------------------------------------------------------------
AnyPackageDsc/Package  Resource  0.1.2    gs--t---      Microsoft.DSC/PowerShell  AnyPackage DSC resources.
AnyPackageDsc/Source   Resource  0.1.2    gs--t---      Microsoft.DSC/PowerShell  AnyPackage DSC resources.

dsc resource export -r AnyPackageDsc/Package

Expected behavior

not hang

Actual behavior

hangs

Error details

If no trace debugging enabled then the process will not return control back to user.

Trace debugging enabled:

2025-05-08T22:16:14.162126Z DEBUG dsc_lib::dscresources::command_resource: 902: PID 25216: jsonOutput={"result":[{<INSERT LARGE JSON>}]}
2025-05-08T22:15:07.945713Z DEBUG dsc_lib::dscresources::command_resource: 660: Process 'pwsh' id 22640 exited with code 0

thread 'main' panicked at C:\__w\1\s\DSC\dsc_lib\src\dscresources\dscresource.rs:444:80:
no entry found for key
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Environment data

7.6-preview4

Version

3.1.0-preview.1

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions