format-default: No coercion operator is defined
See original GitHub issueSteps to reproduce
using namespace System.Collections.Generic
[LinkedList[Hashtable]]::new().AddLast( @{
k1 = "v1"
})
Expected behavior
When this is executed in Windows Powershell, the hashtable is added to the linked list, and the link list is sent to the output stream.
List Next Previous Value
---- ---- -------- -----
{System.Collections.Hashtable} {k1}
Actual behavior
format-default: No coercion operator is defined between types 'System.Collections.Hashtable&' and 'System.Object'.
Environment data
Name Value
---- -----
PSVersion 7.1.1
PSEdition Core
GitCommitId 7.1.1
OS Microsoft Windows 10.0.19041
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:13
Top Results From Across the Web
Expression Cast Error - No coercion operator is defined ...
When I hit "Cast" function I am getting following error: No coercion operator is defined between types 'System.Func`2[CommentUrlCommon,System.
Read more >Error while patching: "No coercion operator is def...
I get the above error while trying to update records in my SQL able. I pulled data from this table into power apps...
Read more >Advice on "no coercion operator is defined between types ' ...
Due to how MySql holds Booleans in Integer fields when the EF hits a boolean I get: "No coercion operator is defined between...
Read more >"No coercion operator is defined between types" exception ...
"No coercion operator is defined between types" exception when using .Query() with composite keys, LightSpeed forum.
Read more >R News
weighted.mean() no longer coerces the weights to a double/numeric vector, ... A minimal method is provided in format.default(x) when isS4(x) is true.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would caution against treating this like an edge case. It is currently, but this pattern is likely to pop up with increasing frequency.
Ideally PowerShell would know how to handle these properties as if they were any other indexer with both a getter and a setter. The setter will be a lot more challenging since iirc
SLE.Expression
will throw with a method invocation on the LHS ofAssign
but forget
it should be able to just dereference.(Note: if
set
is implemented, care should be taken to not allow setting toref readonly
returns)🎉This issue was addressed in #16956, which has now been successfully released as
v7.3.0-preview.3
.🎉Handy links: