-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
This may be the result of me having recently built a new Windows 11 system and not configured powershell the same way as it's configured on my previous Windows 10 desktop. But I'm reporting it in case it's a real change.
I have a wake on lan powershell app I've used for several years on Windows 10. It uses the System.Text.Json serializer to deserialize a JSON file into a specific type of configuration object I've defined.
Under Windows 10 (all updates applied) the following call succeeds:
$config = [JsonSerializer]::Deserialize((Get-Content "c:/Users/Mark/PowerShell/Wake-Device/devices.json"), [Configuration], $null)The third parameter, $null, is a placeholder for unneeded options.
Under Windows 11 on my new desktop this call throws the "multiple ambiguous" error, apparently because powershell cannot determine which Deserialize() method to call.
Removing the $null parameter fixes the problem.
This obviously isn't a big deal...but it's a subtle behavioral change that could cause problems. It certainly caused me to spend quite a bit of time figuring out what was going wrong :).
Expected behavior
The deserialization should succeedActual behavior
The deserialization fails if $null is passed as the third parameterError details
No response
Environment data
Name Value
---- -----
PSVersion 7.2.0
PSEdition Core
GitCommitId 7.2.0
OS Microsoft Windows 10.0.22000
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Visuals
No response