Skip to content

Multiple Ambiguous Error under Windows 11 but not Windows 10 #16506

@markolbert

Description

@markolbert

Prerequisites

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 succeed

Actual behavior

The deserialization fails if $null is passed as the third parameter

Error 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.0

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-AnsweredThe question is answered.WG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions