You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have set the CustomRulePath parameter in the cmdlet implementation in LibraryUsage.tests.ps1 to "string[]" type whereas in the c# implementation it is of "string" type. If we set the CustomRulePath parameter here to "string", then the library usage test fails when run as an administrator. We want to note that the library usage test doesn't fail when run as a non-admin user. Even if we create a "[string[]]" type object and pass it to Initialize method, the tests fail to run as an admin with the following error message.
Assert failed on "Initialize" with "7" argument(s): "Test failed due to terminating error: The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018)
Copy file name to clipboardExpand all lines: Tests/Engine/LibraryUsage.tests.ps1
+8-7Lines changed: 8 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ function Invoke-ScriptAnalyzer {
17
17
18
18
[Parameter(Mandatory=$false)]
19
19
[Alias("CustomizedRulePath")]
20
-
[string] $CustomRulePath=$null,
20
+
[string[]] $CustomRulePath=$null,
21
21
22
22
[Parameter(Mandatory=$false)]
23
23
[switch] $RecurseCustomRulePath,
@@ -41,17 +41,18 @@ function Invoke-ScriptAnalyzer {
41
41
[Parameter(Mandatory=$false)]
42
42
[string] $Profile=$null
43
43
)
44
-
[string[]]$customRulePathArr=@($CustomRulePath);
45
-
if ($CustomRulePath-eq$null)
46
-
{
47
-
$customRulePathArr=$null;
48
-
}
44
+
# There is an inconsistency between this implementation and c# implementation of the cmdlet.
45
+
# The CustomRulePath parameter here is of "string[]" type whereas in the c# implementation it is of "string" type.
46
+
# If we set the CustomRulePath parameter here to "string[]", then the library usage test fails when run as an administrator.
47
+
# We want to note that the library usage test doesn't fail when run as a non-admin user.
48
+
# The following is the error statement when the test runs as an administrator.
49
+
# Assert failed on "Initialize" with "7" argument(s): "Test failed due to terminating error: The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018)"
0 commit comments