Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improve error message from Start-NativeExecution#26500

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
logiclrd wants to merge2 commits intoPowerShell:master
base:master
Choose a base branch
Loading
fromlogiclrd:start-nativeexecution-error-report-cwd

Conversation

@logiclrd
Copy link
Contributor

PR Summary

Update theStart-NativeExecution cmdlet that is part of the build infrastructure to report the directory in which the script block was executed, in the event of an error.

PR Context

I ranStart-PSBuild, and it failed with an error during the ResGen phase:

PS /code/PowerShell> Start-PSBuild                                  VERBOSE: Using default feeds which are Microsoft, use -UseNuGetOrg to switch to Public feedsWARNING: The 'dotnet' in the current path can't find SDK version 10.0.100, prepending /home/logiclrd/.dotnet to PATH.VERBOSE: In Find-DotNetVERBOSE: Executing:  dotnet --list-sdks VERBOSE: Find-DotNet: dotnetCLIInstalledVersion = 10.0.100; chosenDotNetVersion = 10.0.100VERBOSE: Using configuration 'Debug'VERBOSE: Using framework 'net10.0'VERBOSE: Using runtime 'linux-x64'VERBOSE: Top project directory is /code/PowerShell/src/powershell-unix=== BEGIN: Restore NuGet Packages ======= END: Restore NuGet Packages ====Run ResGen (generating C# bindings for resx files)The build failed. Fix the build errors and run again.Exception: /code/PowerShell/tools/buildCommon/startNativeExecution.ps1:42Line |  42 |                  throw $errorMessage     |                  ~~~~~~~~~~~~~~~~~~~     | Execution of { dotnet run } by build.psm1: line 2666 failed with exit code 1PS /code/PowerShell>

This error message told mewhat went wrong:dotnet run

It told me in general terms what was happening when it went wrong:Run ResGen

But this information alone wasn't enough to diagnose the problem.dotnet run in the root obviously doesn't do anything and isn't connected with the error at all. I had to open upbuild.psm1 and find out what exactly was on line 2666:

function Start-ResGen{    [CmdletBinding()]    param()    # Add .NET CLI tools to PATH    Find-Dotnet    Push-Location "$PSScriptRoot/src/ResGen"    try {        Start-NativeExecution { dotnet run } | Write-Verbose    } finally {        Pop-Location    }}

Ahh. It's doing it inside./src/ResGen.

So, this PR updates the error message so that obtaining this context doesn't require peeking intobuild.psm1 directly:

Exception: /code/PowerShell/tools/buildCommon/startNativeExecution.ps1:42Line |  42 |                  throw $errorMessage     |                  ~~~~~~~~~~~~~~~~~~~     | Execution of { dotnet run } in '/code/PowerShell/src/ResGen' by build.psm1: line 2666 failed with exit code 1

PR Checklist

… executing the script block and then include it in the error message if one happens.
@logiclrdlogiclrd requested review froma team andjshigetomi ascode ownersNovember 20, 2025 16:27
@iSazonoviSazonov added the CL-ToolsIndicates that a PR should be marked as a tools change in the Change Log labelNov 24, 2025
@microsoft-github-policy-servicemicrosoft-github-policy-servicebot added the Review - NeededThe PR is being reviewed labelDec 1, 2025
@microsoft-github-policy-service
Copy link
Contributor

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for7 days.
Maintainer, please provide feedback and/or mark it asWaiting on Author

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@daxian-dbwdaxian-dbwdaxian-dbw left review comments

@jshigetomijshigetomiAwaiting requested review from jshigetomijshigetomi is a code owner

+1 more reviewer

@kilasuitkilasuitkilasuit approved these changes

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

CL-ToolsIndicates that a PR should be marked as a tools change in the Change LogReview - NeededThe PR is being reviewed

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@logiclrd@daxian-dbw@kilasuit@iSazonov

[8]ページ先頭

©2009-2025 Movatter.jp