Skip to content

Support for DSC minimum version#5525

Merged
JohnMcPMS merged 4 commits into
microsoft:masterfrom
JohnMcPMS:dsc-minver
Jun 13, 2025
Merged

Support for DSC minimum version#5525
JohnMcPMS merged 4 commits into
microsoft:masterfrom
JohnMcPMS:dsc-minver

Conversation

@JohnMcPMS
Copy link
Copy Markdown
Member

@JohnMcPMS JohnMcPMS commented Jun 12, 2025

Change

Adds a state machine for finding a version of DSC that meets our minimum requirements. It first attempts to use the stable release, falling back to the preview version if it is not new enough. This allows us to have functional, if less than ideal, user experience while we wait for DSC to ship a GA version.

Both callers (winget and PS module) are updated to handle the state machine transition mechanics, which means they need to install stable/preview versions when requested.

Also fixes some issues with the PS module install flow.

Validation

Manually confirmed that being up to date for both packages works, as well as having neither present.

Microsoft Reviewers: Open in CodeFlow

yao-msft
yao-msft previously approved these changes Jun 13, 2025
// Whether to request detailed traces from the processor.
// Read / Write
DiagnosticTraceEnabled,
// The path to the dsc.exe executable, as discovered.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: copy paste comment

else
{
this.Write(StreamType.Warning, $"Unrecognized value from FindDscStateMachine: {nextTransition ?? "<null>"}");
throw new FileNotFoundException(Resources.DscExeNotFound, "dsc.exe");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we throw some other exception to show it's internal error?

{
this.Write(StreamType.Error, Resources.ConfigurationInstallDscPackageFailed);
this.Write(StreamType.Verbose, installDSCv3.GetErrorMessage() ?? "<Unknown error>");
this.Write(StreamType.Warning, Resources.ConfigurationInstallDscPackageFailed);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we change to warning here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error must be an ErrorRecord object, not a string. I can look at creating one, but there isn't an easy "from a string" method to do so.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I think that writing to Error and throwing an exception are effectively the same thing except for execution flow.

@JohnMcPMS JohnMcPMS merged commit ab7417e into microsoft:master Jun 13, 2025
9 checks passed
@JohnMcPMS JohnMcPMS deleted the dsc-minver branch June 13, 2025 21:38
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

Successfully merging this pull request may close these issues.

2 participants