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
$document= {
Get-DscResource TestStub |Import-DscResource
TestStub a @{
Key='a'ThrowOnSet='always'
}
}
$instructions= ConfigInstructions Name $document$instructions|Invoke-ConfigStep
The above code results in an endless loop.
Solution
Exceptions thrown by resources should be caught, the resource marked as "failed" (or maybe "ExceptionThrown"), and then the exception re-thrown. If the resource is marked with a new value like "ExceptionThrown", the state machines should also be altered to raise and handle 'AtExceptionThrown' events.
The text was updated successfully, but these errors were encountered:
Currently the config instructions enumerable does not catch exceptions that invoking a resource might throw. This can lead to an endless loop.
Repro
Running this code causes an endless loop.
The above code results in an endless loop.
Solution
Exceptions thrown by resources should be caught, the resource marked as "failed" (or maybe "ExceptionThrown"), and then the exception re-thrown. If the resource is marked with a new value like "ExceptionThrown", the state machines should also be altered to raise and handle 'AtExceptionThrown' events.
The text was updated successfully, but these errors were encountered: