Skip to content

Fix invoking WriteError from rule execution threads#497

Merged
kapilmb merged 3 commits into
developmentfrom
FixSuppressRuleWriteError
Apr 8, 2016
Merged

Fix invoking WriteError from rule execution threads#497
kapilmb merged 3 commits into
developmentfrom
FixSuppressRuleWriteError

Conversation

@kapilmb

@kapilmb kapilmb commented Apr 7, 2016

Copy link
Copy Markdown

Whenever Helper.SuppressRule encounters any error, it invokes Cmdlet.WriteError. When running script rules, SuppressRule is called from rule execution threads. As such, Cmdlet.WriteError gets called from the rule execution threads. This results in an InvalidOperationException because this method can be called only from within BeginProcessing, ProcessRecord and EndProcessing and only within the main program thread.

Fixes #496


This change is Reviewable

Whenever Helper.SuppressRule encounters any error, it invokes Cmdlet.WriteError. When running script rules, SuppressRule is called from rule execution threads. As such, Cmdlet.WriteError gets called from the rule execution threads. This results in an InvalidOperationException because this method can be called only from within BeginProcessing, ProcessRecord and EndProcessing and only within the main program thread.
@raghushantha

Copy link
Copy Markdown
Member

Reviewed 2 of 2 files at r1, 1 of 1 files at r3.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@raghushantha

Copy link
Copy Markdown
Member

:lgtm:


Comments from Reviewable

@kapilmb kapilmb merged commit 23481da into development Apr 8, 2016
@kapilmb kapilmb deleted the FixSuppressRuleWriteError branch April 11, 2016 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants