I am trying to use a Retry Service that is written in the fluent-api pattern. The methods return the service and allow a chaining of methods. However even though i am using --> ` <-- i see a lot of errors as shown below.
Is there any workaround or other possibility to not write everything into one line? (I already checked the methods names and return types)
Unfortunately about_Methods doesn't seem to have a clarification on method chaining and its parsing rules. If you want to chain multiple methods on new lines, the dot .
has to be at the end of each statement then a newline is allowed. The backticks are not needed. Note that the same rule applies to Properties, not only Methods, however this is a less commonly used or needed.
In example:
[powershell]::Create().
AddScript({ "hello $args" }).
AddArgument('world').
Invoke()