Deepak Mittal brings us this support experience today.... 

Problem Description

Lets say you have created a check-in policy in TFS 2012 which should display a dialog box to perform some actions at the time of check-in, but this may not work and throw error : "Internal error in the Policy. The calling thread must be STA, because many UI components require this."

 

 

Resolution:

The code should create UI elements in main thread via methods like Control.Invoke. Something like:

public override PolicyFailure[] ABC()

{

return Application.Current.Dispatcher.Invoke(() =>

{

}

}