Skip to content

Fix invoking WriteError from rule execution threads #497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 8, 2016

Conversation

kapilmb
Copy link

@kapilmb kapilmb commented Apr 7, 2016

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
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
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