question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

format-default: No coercion operator is defined

See original GitHub issue

Steps 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:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:13

github_iconTop GitHub Comments

1reaction
SeeminglySciencecommented, Jul 10, 2021

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 of Assign but for get it should be able to just dereference.

(Note: if set is implemented, care should be taken to not allow setting to ref readonly returns)

0reactions
msftbot[bot]commented, Mar 21, 2022

🎉This issue was addressed in #16956, which has now been successfully released as v7.3.0-preview.3.🎉

Handy links:

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found