TFPT.EXE CreateTeamProject – Gremlin 0x8001010A … under observation

If you have stumbled over a gremlin, that has been reported by us and is currently under investigation. One of the troublesome HOL setup scripts is the one below, whereby lines 101, 103, 105 and 107 have been inserted to nudge ourselves around the issue.

    1: # Copyright © Microsoft Corporation.  All Rights Reserved.
    2: # This code released under the terms of the 
    3: # Microsoft Public License (MS-PL, https://opensource.org/licenses/ms-pl.html.)
    4: #
    5:  
    6: #Simply writes a blank to the screen
    7: function blankLine
    8: {
    9:     Write-Host -Object:""
   10: }
   11:  
   12: function showLine ( [string]$text )
   13: {
   14:     Write-Host -Object:$text
   15: }
   16:  
   17: function showLineR ( [string]$text )
   18: {
   19:     Write-Host -ForegroundColor Red -Object:$text
   20: }
   21:  
   22: function waitForKey()
   23: {
   24:   ShowLineR "Press any key to continue..."
   25:   $inputKey = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyUp")  
   26:   blankLine
   27: }
   28:  
   29: function displayWelcome
   30: {
   31: blankLine
   32: blankLine
   33: showLine "Welcome to the Visual Studio 2010 ALM Rangers TFS Integration Platform HOL setup script
   34:  
   35: This script is intended to configure the HOL environments on the Rangers Base VM."
   36: showLineR "This script must be run as a user with administrator rights."
   37: blankLine
   38: showLineR "WARNING: THIS IS NOT INTENDED FOR PRODUCTION USE!"
   39: blankLine
   40: showLine "We recommend that you launch Visual Studio and connect to TFS to ensure
   41: that all services are started and functional, before starting this HOL script.
   42:  
   43: This script will:
   44: ----------------
   45: - Configure the TFS Integration Platform HOL environment"
   46: showLine
   47: showLineR "TAKE NOTE: Prerequisites for the HOLs and this script to work:"
   48: "-------------------------------------------------------------
   49: - Team Foundation Server 2010 (RTM version)
   50: - Visual Studio 2010 Ultimate (RTM version)
   51: - Internet Information Server (IIS)
   52: - Windows SharePoint Services (WSS) or MOSS
   53: - TFS 2010 Power Tools (a version is available under c:\hol\prerequisite software)"
   54: blankLine
   55: showLineR "Environment variables:"
   56: "---------------------
   57: - The script is dependent on the system environment variables for both 64-bit and 32-bit
   58: - If you install TFS, Visual Studio and/or TFS PowerTools you must reboot the system
   59:   before running this script to ensure that the environment variables are available.
   60:   
   61: Snapshot:
   62: --------
   63: - We recommend that you snapshot your VM before running the script, because the script cannot
   64:   be re-run if a failure (for example a missing prerequisite) occurs.
   65: - We also recommend that you snapshot your VM after running the script, so that you can reset
   66:   your HOL environment at any time.
   67:  
   68: If you wish to ABORT press Ctrl+C now, else 
   69:     
   70: Press any key to begin..."
   71:   $inputKey = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyUp")  
   72: blankLine
   73: }
   74:  
   75:  
   76: function blankLine
   77: {
   78:     Write-Host -Object:""
   79: }
   80:  
   81: function showLineR ( [string]$text )
   82: {
   83:     Write-Host -ForegroundColor Red -Object:$text
   84: }
   85:  
   86: function waitForKey()
   87: {
   88:   ShowLineR "Press any key to continue..."
   89:   $inputKey = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyUp")  
   90:   blankLine
   91: }
   92:  
   93: function SetupHOL
   94: {
   95:  $currentLocation = Get-Location
   96:  $tempLocation    = Get-content env:tfspowertooldir
   97:  Set-Location $tempLocation
   98:  
   99:  #Create team project with tfpt
  100:  .\TFPT.EXE createteamproject /settingsfile:'C:\HOL\TFS Integration Platform\HOLSetup\Project_TP-A.XML'
  101:  waitForKey
  102:  .\TFPT.EXE createteamproject /settingsfile:'C:\HOL\TFS Integration Platform\HOLSetup\Project_TP-B.XML'
  103:  waitForKey
  104:  .\TFPT.EXE createteamproject /settingsfile:'C:\HOL\TFS Integration Platform\HOLSetup\Project_TP-C.XML'
  105:  waitForKey
  106: .\TFPT.EXE createteamproject /settingsfile:'C:\HOL\TFS Integration Platform\HOLSetup\Project_RationalDemo.XML'
  107:  waitForKey
  108:  
  109:  $tempLocation    = Get-content env:vs100comntools
  110:  Set-Location $tempLocation
  111:  
  112:  #Create Workspace
  113:  Write-Host -Object:"Create Workspace TP-A"
  114:  ..\IDE\TF.EXE workspace /new TP-A /noprompt /collection:https://localhost:8080/tfs/DefaultCollection
  115:  ..\IDE\TF.EXE workfold  /map $/TP-A 'C:\HOL\TFS Integration Platform\Source Code\Demo\Sandbox-A'     /workspace:TP-A
  116:  ..\IDE\TF.EXE workfold  /unmap $/
  117:  
  118:  Write-Host -Object:"Create Workspace TP-B"
  119:  ..\IDE\TF.EXE workspace /new TP-B /noprompt /collection:https://localhost:8080/tfs/DefaultCollection
  120:  ..\IDE\TF.EXE workfold  /map $/TP-B 'C:\HOL\TFS Integration Platform\Source Code\Demo\Sandbox-B'     /workspace:TP-B
  121:  ..\IDE\TF.EXE workfold  /unmap $/
  122:  
  123:  Write-Host -Object:"Create Workspace TP-C"
  124:  ..\IDE\TF.EXE workspace /new TP-C /noprompt /collection:https://localhost:8080/tfs/DefaultCollection
  125:  ..\IDE\TF.EXE workfold  /map $/TP-C 'C:\HOL\TFS Integration Platform\Source Code\Demo\Sandbox-C'     /workspace:TP-C
  126:  ..\IDE\TF.EXE workfold  /unmap $/
  127:  
  128:  #Create the VC space as per HOL
  129:  Write-Host -Object:"Checkin code and branches"
  130:  ..\IDE\TF.EXE add       'C:\HOL\TFS Integration Platform\Source Code\Demo\Sandbox-A\Main'         /recursive
  131:  ..\IDE\TF.EXE checkin   'C:\HOL\TFS Integration Platform\Source Code\Demo\Sandbox-A\Main'         /comment:'HOL Automated Checkin' /recursive /noprompt
  132:  ..\IDE\TF.EXE branch    'C:\HOL\TFS Integration Platform\Source Code\Demo\Sandbox-A\Main’      ‘$/TP-A/Dev’
  133:  ..\IDE\TF.EXE checkin   'C:\HOL\TFS Integration Platform\Source Code\Demo\Sandbox-A\Dev'         /comment:'HOL Automated Branch' /noprompt
  134:  copy 'C:\HOL\TFS Integration Platform\HOLSetup\Raw\HelloWorldDemo' 'C:\HOL\TFS Integration Platform\Source Code\Demo\Sandbox-A\Dev' -recurse
  135:  ..\IDE\TF.EXE add       'C:\HOL\TFS Integration Platform\Source Code\Demo\Sandbox-A\Dev\HelloWorldDemo'     /recursive
  136:  ..\IDE\TF.EXE checkin   'C:\HOL\TFS Integration Platform\Source Code\Demo\Sandbox-A\Dev'         /comment:'HOL Automated Checkin' /recursive /noprompt
  137:  
  138:  $tempLocation    = Get-content env:tfspowertooldir
  139:  Set-Location $tempLocation
  140:  
  141:  #create workitem
  142:  .\TFPT.EXE workitem /new TP-A\Bug /Fields:"Title=Change the string goodbye world to hello world;Assigned To= Administrator" /collection:'https://localhost:8080/tfs/defaultcollection'
  143:  Set-Location $currentLocation
  144: }
  145:  
  146: displayWelcome    
  147: SetupHOL

Problem

It “seems” that when we execute the “TFPT.EXE createteamproject” command in rapid succession the Visual Studio process, started by the tool, does not close or get the opportunity to close quickly enough. When the process does not terminate before the next command is run, the command fails with a COM exception. What is odd, is that in some development environments the error does not occur, whereas in other environments it raises its ugly head repetitively.

The problem has been reproduced, documented and reported to the team Foundation Server 2010 Power Tools team.

Error reported

Unexpected error occurred.

System.Runtime.InteropServices.COMException (0x8001010A): Creating an instance of the COM component with CLSID {656D8328-93F5-41A7-A48C-B42858161F25} from the IClassFactory failed due to the following error: 8001010a.

Workaround

In our setup script we force a wait after running the “TFPT.EXE createteamproject” command, allowing the user to double check if the visual studio process (denenv.exe) has terminated, before continuing with the next create team project request.

Hope this helps … just in case you meet the same gremlin :)