Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-StoreBrokerConfigFile generates incorrect targetPublishDate value in PowerShell Core 6.2+ #179

Closed
riverar opened this issue Oct 29, 2019 · 4 comments · Fixed by #180
Closed

Comments

@riverar
Copy link
Contributor

riverar commented Oct 29, 2019

Windows 10 1909 18363.418
PSVersion 6.2.0 ⚠ PowerShell Core ⚠ (Also seeing this on Azure DevOps with Windows PowerShell)
StoreBroker 1.19.1

When generating a new configuration via New-StoreBrokerConfigFile, the targetPublishDate value is incorrectly specified as an object containing value and DateTime properties. When attempting to submit this later via Update-ApplicationSubmission the API will reject it.

Generated snippet:

"targetPublishDate": {
  "value": "1601-01-01T00:00:00Z",
  "DateTime": "Monday, January 1, 1601 12:00:00 AM"
}

Sample response (MS-CorrelationId: e767cde6-b049-4908-804f-beeaa36eafbd):

{
  "code": "InvalidParameterValue",
  "data": [],
  "details": [],
  "message": "Unexpected character encountered while parsing value: {. Path 'targetPublishDate', line 12, position 24.",
  "source": "Ingestion Api",
  "target": "submissionRequest.targetPublishDate"
}
@riverar riverar changed the title New-StoreBrokerConfigFile generates incorrect targetPublishDate value New-StoreBrokerConfigFile generates incorrect targetPublishDate value in PowerShell Core 6.2+ Oct 29, 2019
@riverar riverar changed the title New-StoreBrokerConfigFile generates incorrect targetPublishDate value in PowerShell Core 6.2+ New-StoreBrokerConfigFile generates incorrect targetPublishDate value Oct 29, 2019
@riverar
Copy link
Contributor Author

riverar commented Oct 29, 2019

Thought this issue was specific to PowerShell Core but am also seeing this on Azure DevOps using Windows PowerShell 5.x.

@HowardWolosky
Copy link
Member

Interesting. This does not repro for me at all on PS 5.1.19013.1002.

Here's the simple repro:

  $rawSub = '{"id":"123245","applicationCategory":"UtilitiesAndTools","visibility":"Public","targetPublishMode":"Immediate","targetPublishDate":"1601-01-01T00:00:00.0000000Z","friendlyName":"Submission 87","trailers":[]}'
  $sub = $rawSub | convertfrom-json
  Write-Host ('          "targetPublishDate": .*,' -replace '"targetPublishDate": .*,', "`"targetPublishDate`": $($sub.targetPublishDate | ConvertTo-Json)")

On PS 5.1.19013.1002, this returns back:
"targetPublishDate": "1601-01-01T00:00:00.0000000Z"

I'd like to better understand why we're seeing a difference in behavior here before I'd take any change to the code.

@riverar
Copy link
Contributor Author

riverar commented Oct 29, 2019

Yep, looks to be PowerShell Core specific.

PowerShell Core 6.2.0

PS> $x = ConvertFrom-Json '{"id":"123245","applicationCategory":"UtilitiesAndTools","visibility":"Public","targetPublishMode":"Immediate","targetPublishDate":"1601-01-01T00:00:00.0000000Z","friendlyName":"Submission 87","trailers":[]}'
PS> $x.targetPublishDate | ConvertTo-Json
{
  "value": "1601-01-01T00:00:00Z",
  "DateTime": "Monday, January 1, 1601 12:00:00 AM"
}

Windows PowerShell 5.1.18362.145

PS> $x = ConvertFrom-Json '{"id":"123245","applicationCategory":"UtilitiesAndTools","visibility":"Public","targetPublishMode":"Immediate","targetPublishDate":"1601-01-01T00:00:00.0000000Z","friendlyName":"Submission 87","trailers":[]}'                                                                                                             
PS> $x.targetPublishDate | ConvertTo-Json
"1601-01-01T00:00:00.0000000Z"

My Azure Pipeline data point is invalid. It was working with a tainted StoreBroker configuration file. Thanks!

@riverar riverar changed the title New-StoreBrokerConfigFile generates incorrect targetPublishDate value New-StoreBrokerConfigFile generates incorrect targetPublishDate value in PowerShell Core 6.2+ Oct 29, 2019
@HowardWolosky
Copy link
Member

Thanks for calling attention to this though. This looks like further debt with ensuring that this runs correctly with PS Core 6+. I think more end-to-end testing needs to be done in that environment so that a holistic look at all the work that needs to be done can be done at once. For instance, if this change was to be fixed, we'd also need to make a similar change for the IAP code in PackageTool, and possibly with the API-interacting code in the other files (still to be tested). It might also be worthwhile checking to see if this is actually working as intended by the PowerShell team, or if it's in fact a bug in PS Core 6.

HowardWolosky pushed a commit that referenced this issue Aug 27, 2020
…#180)

The `targetPublishDate` value was getting incorrectly converted to json when generating the config file.

Resolves #179
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 a pull request may close this issue.

2 participants