locked
Which rule is currently executed? RRS feed

  • Question

  • Hi,

    I have a widows form app and I am using a .Rules file as an embedded resource.
    I want to debug or know which rule is getting executed at a particular time and what are the values.
    Is there anyway I can place a breakpoint or do something to view this info?

    Pls help asap.
    Monday, April 13, 2009 10:00 AM

Answers

  • Turning on tracing is the only way to get any insight into what the rules engine is doing as it executes the rules. You can turn on tracing by adding the lines into your app.config described in the "Enabling Workflow Logging" section of this article:

    http://msdn.microsoft.com/en-us/library/ms732240.aspx

    The piece you're interested in is the System.Workflow.Activities.Rules tracing, so you could probably shorten that to this:

    <system.diagnostics>
        <switches>
            <add name="System.Workflow LogToFile" value="1" />
            <add name="System.Workflow.Activities.Rules" value="All" />       
        </switches>
    </system.diagnostics>
    Tracing cannot tell you the values of the variables being checked in the rules, but it will tell you which rules were being executed, and which ones passed or failed. There's no way to set breakpoints during rule evaluation; the best you can do to get additional information about the state of the workflow variables would be to use the Workflow Tracking service and emit the relevant variable values inside your workflow (e.g. by calling the TrackData method):

    http://msdn.microsoft.com/en-us/library/system.workflow.componentmodel.activity.trackdata.aspx
    Monday, April 13, 2009 6:31 PM