Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7015237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:37:34+00:00 2026-05-27T22:37:34+00:00

I’ve created a custom check-in policy for TFS by writing a class that extends

  • 0

I’ve created a custom check-in policy for TFS by writing a class that extends PolicyBase (as per MSDN How To: Create Custom Check-in Policies in Visual Studio Team Foundation). The overridden Evaluate() method is where I’ve got my logic.

Evaluate() gets called when the user clicks the Check In button in TFS which is great as that is what I want.

However, it also seems like Evaluate() gets called when:

  1. Visual Studio is launched AND
  2. The user navigates to the Pending Changes tab for the first time (or if this is already the active tab when VS is launched) AND
  3. The user has items in the pending changes tab.

How can I check under what scenario Evaluate is called? I would only like Evaluate to be called when the user explicitly clicks the Check In button in TFS.

The actual Evaluate method I’m using is quite complicated but I’ve simplified it to something that still exhibits the same problem:

public override PolicyFailure[] Evaluate()
{
    List<PolicyFailure> policyFailures = new List<PolicyFailure>();

    if (_isPolicyEnabled)
    {
        if (PendingCheckin.PendingChanges.Comment.Contains("*"))
        {
            string msg = "Star in comment";
            MessageBox.Show(msg);
            policyFailures.Add(new PolicyFailure(msg, this));
        }
    }
    return policyFailures.ToArray();
}

With the above code, if there is a star in the check-in comment and there are Pending Changes, close Visual Studio, when you re-open it will throw up the MessageBox as soon as you navigate to the Pending Changes tab.

The way the check-in policy is being used in my situation is that I check the user’s comment for references to items in another system. If they are not present then I throw up an interactive dialog that shows the user a list of items which can be filtered and selected. These are then inserted into their check-in comment. Is there a way within the Evaluate() to find out under which scenario it is called? I could avoid throwing up the dialog under all calls except those triggered by a Check-In.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:37:34+00:00Added an answer on May 27, 2026 at 10:37 pm
    • Evaluate() shouldn’t display UI (as Edward Thomson already
      mentioned).
    • Evaluate() should just create failures if there are any
      issues.

    This will create a list of failures that the user can then double click on. The double clicking of a failure can then be used (handled by the Activate()) to trigger UI components to be displayed. I haven’t tried this yet but it pretty much seems like it will work.

    The details are in this MSDN forum post: Prompting user from checkin policy occurs multiple times.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I need a function that will clean a strings' special characters. I do NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.