【发布时间】:2010-10-20 15:53:49
【问题描述】:
我有一个来自 .Net 的对象,该对象具有 SyncHashTable 类型的属性,如果不抛出异常,则无法查看该属性。
单行重现:
[HashTable]::Synchronized(@{})
使用repro更容易玩多行:
$ht = new-object hashtable
$ht.add("foo", "bar")
$hts = [Hashtable]::Synchronized($ht)
$hts
错误:
format-default : Object reference not set to an instance of an object.
+ CategoryInfo : NotSpecified: (:) [format-default], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.Commands.FormatDefaultCommand
有人对此有任何见解吗?
【问题讨论】:
标签: powershell hashtable synchronized