MSHのデバッグ手法(4)

Windows "Monad" Shell Beta 2 Documentation Packに含まれる「TracingQuickStart.doc」には、
デバッグ系の情報がまとまっています。

trace-expression

trace-expressionは引数として渡したスクリプトについて、
特定のトレースソースを有効にします。

例えば、以下のスクリプトにおいて、

$a = [int][string][double]"234.567"

型変換のトレースソースを有効にしてみます。

MSH C:\> trace-expression TypeConversion { $a = [int][string][double]"234.567"
>>  } -mshhost
>>
DEBUG: TypeConversion Information: 0 : Converting "double" to "System.Type".
DEBUG: TypeConversion Information: 0 :     Standard type conversion.
DEBUG: TypeConversion Information: 0 :         Type conversion from string.
DEBUG: TypeConversion Information: 0 :             Conversion to System.Type
DEBUG: TypeConversion Information: 0 :     The conversion is a standard conversion.
 No custom type conversion will be attempted.
DEBUG: TypeConversion Information: 0 : Converting "234.567" to "System.Double".
DEBUG: TypeConversion Information: 0 :     Standard type conversion.
DEBUG: TypeConversion Information: 0 :         Type conversion from string.
DEBUG: TypeConversion Information: 0 :             Converting to double or single.
DEBUG: TypeConversion Information: 0 :     The conversion is a standard conversion.
 No custom type conversion will be attempted.
DEBUG: TypeConversion Information: 0 : Converting "string" to "System.Type".
DEBUG: TypeConversion Information: 0 :     Standard type conversion.
DEBUG: TypeConversion Information: 0 :         Type conversion from string.
DEBUG: TypeConversion Information: 0 :             Conversion to System.Type
DEBUG: TypeConversion Information: 0 :     The conversion is a standard conversion.
 No custom type conversion will be attempted.
DEBUG: TypeConversion Information: 0 : Converting "234.567" to "System.String".
DEBUG: TypeConversion Information: 0 :     Standard type conversion.
DEBUG: TypeConversion Information: 0 :         Converting numeric to string.
DEBUG: TypeConversion Information: 0 :     The conversion is a standard conversion.
 No custom type conversion will be attempted.
DEBUG: TypeConversion Information: 0 : Converting "int" to "System.Type".
DEBUG: TypeConversion Information: 0 :     Standard type conversion.
DEBUG: TypeConversion Information: 0 :         Type conversion from string.
DEBUG: TypeConversion Information: 0 :             Conversion to System.Type
DEBUG: TypeConversion Information: 0 :     The conversion is a standard conversion.
 No custom type conversion will be attempted.
DEBUG: TypeConversion Information: 0 : Converting "234.567" to "System.Int32".
DEBUG: TypeConversion Information: 0 :     Standard type conversion.
DEBUG: TypeConversion Information: 0 :         Type conversion from string.
DEBUG: TypeConversion Information: 0 :             Converting to integer.
DEBUG: TypeConversion Information: 0 :             Exception converting to 
 integer: "Input string was not in a correct format.".
DEBUG: TypeConversion Information: 0 :             Converting to integer
 passing through double.
DEBUG: TypeConversion Information: 0 :             Numeric Conversion
 through Syustem.Double.
DEBUG: TypeConversion Information: 0 :     The conversion is a standard 
 conversion. No custom type conversion will be attempted.

このようにMSH内部の型変換の様子が分かります。