Repository navigation
DataRow: Unwrap PSObject values when assigning columns - #28221
Open
lsmlhi_25 (FOWEPJF255) wants to merge 1 commit into
Open
lsmlhi_25 (FOWEPJF255) wants to merge 1 commit into
lsmlhi_25 (FOWEPJF255) wants to merge 1 commit into
Conversation
Unwrap PSObject values for DataRow and DataRowView property and indexer assignments. Add regression coverage for DateTime columns. Fixes PowerShell#17627
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The changes are narrowly scoped, cover both assignment paths with regression tests, and have no unresolved findings.
0 open findings
What changed in this PR
Fixes #17627 by unwrapping PSObject values before assigning data columns, allowing PowerShell-produced values such as Get-Date results.
Changes:
- Updates property and indexer setters for
DataRowandDataRowView. - Adds regression tests for both assignment forms and types.
| File | Description |
|---|---|
| test/powershell/engine/ETS/Adapter.Tests.ps1 | Tests wrapped DateTime assignments. |
| src/System.Management.Automation/engine/runtime/Binding/Binders.cs | Unwraps values for the affected indexer setters. |
| src/System.Management.Automation/engine/CoreAdapter.cs | Unwraps values in both property setters. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Unwrap
PSObjectvalues duringDataRowandDataRowViewassignment so PowerShell-produced values such asDateTimeare accepted by .NET data columns.PR Context
The
Get-Daterepro in #17627 fails on current PowerShell becauseDataRowreceives aPSObjectwrapper instead of the wrappedDateTime. This change unwraps values inDataRowandDataRowViewproperty setters and in object-valued indexer setters for those two types. Regression tests cover property and indexer assignments toDateTimecolumns on both types.A similar fix was proposed in #19071. That PR was closed without merging on 2026-10-08. This PR revalidates the focused behavior against current
masterand adds regression coverage.Fixes #17627
Verification
Start-PSBuild -Configuration Debug -UseNuGetOrg -SkipRoslynAnalyzerspassed with the repository-pinned .NET SDK 11.0.100-rc.1.Start-PSPester -Path test/powershell/engine/ETS/Adapter.Tests.ps1 -Tag CI -ThrowOnFailure -Tersepassed: 34 passed, 0 failed, 3 pending.pwshpassed for bothDataRowproperty and indexer setters.PR Checklist
.csand.ps1files have the correct Microsoft copyright and license headers; no new source files were added.