@@ -43,32 +43,32 @@ function Create-ParameterObjectImpl
43
43
44
44
if ($typeInfo.FullName -like " Microsoft.*Azure.Management.*.*" -and (-not ($typeInfo.FullName -like " Microsoft.*Azure.Management.*.SubResource" )))
45
45
{
46
- $typeList.Add ($typeInfo.FullName , $typeInfo );
46
+ $st = $ typeList.Add ($typeInfo.FullName , $typeInfo );
47
47
}
48
48
49
49
if ($typeInfo.FullName -eq ' System.String' -or $typeInfo.FullName -eq ' string' )
50
50
{
51
- return ' ' ;
51
+ $obj = ' ' ;
52
52
}
53
- if ($typeInfo.FullName -eq ' System.Uri' )
53
+ elseif ($typeInfo.FullName -eq ' System.Uri' )
54
54
{
55
- return ' ' -as ' System.Uri' ;
55
+ $obj = ' ' -as ' System.Uri' ;
56
56
}
57
57
elseif ($typeInfo.FullName -eq ' System.Boolean' )
58
58
{
59
- return $false ;
59
+ $obj = $false ;
60
60
}
61
61
elseif ($typeInfo.FullName -eq ' System.Int32' )
62
62
{
63
- return 0 ;
63
+ $obj = 0 ;
64
64
}
65
65
elseif ($typeInfo.FullName -eq ' System.UInt32' )
66
66
{
67
- return 0 ;
67
+ $obj = 0 ;
68
68
}
69
69
elseif ($typeInfo.FullName -eq ' System.Byte[]' )
70
70
{
71
- return New-Object - TypeName System.Byte[] - ArgumentList 0 ;
71
+ $obj = New-Object - TypeName System.Byte[] - ArgumentList 0 ;
72
72
}
73
73
elseif ($typeInfo.FullName -like ' System.Collections.Generic.IList*' -or $typeInfo.FullName -like ' System.Collections.Generic.List*' )
74
74
{
@@ -79,16 +79,16 @@ function Create-ParameterObjectImpl
79
79
$listObj = New-Object - TypeName $typeName ;
80
80
$listObj.Add ($itemObj );
81
81
82
- return $listObj ;
82
+ $obj = $listObj ;
83
83
}
84
84
elseif ($typeInfo.FullName -like ' System.Collections.Generic.IDictionary*' )
85
85
{
86
86
# Dictionary in client library always consists of string key & values.
87
- return New-Object ' System.Collections.Generic.Dictionary[string,string]' ;
87
+ $obj = New-Object ' System.Collections.Generic.Dictionary[string,string]' ;
88
88
}
89
89
elseif ($typeInfo.FullName -like ' System.Nullable*' )
90
90
{
91
- return $null ;
91
+ $obj = $null ;
92
92
}
93
93
else
94
94
{
@@ -110,18 +110,20 @@ function Create-ParameterObjectImpl
110
110
$listTypeName = " System.Collections.Generic.List[" + $itemType.FullName + " ]" ;
111
111
112
112
$propObjList = New-Object - TypeName $listTypeName ;
113
- $propObjList.Add ($itemObj );
113
+ $st = $ propObjList.Add ($itemObj );
114
114
115
- $prop.SetValue ($obj , $propObjList -as $listTypeName );
115
+ $st = $ prop.SetValue ($obj , $propObjList -as $listTypeName );
116
116
}
117
117
else
118
118
{
119
119
$propObj = Create- ParameterObjectImpl $prop.PropertyType $typeList ;
120
- $prop.SetValue ($obj , $propObj );
120
+ $st = $ prop.SetValue ($obj , $propObj );
121
121
}
122
122
}
123
123
}
124
124
125
+ $st = $typeList.Remove ($typeInfo.FullName );
126
+
125
127
return $obj ;
126
128
}
127
129
0 commit comments