Wednesday 31 December 2014

Quick Edit Code in VSO

Quick code editing in Visual Studio Online is a newly added feature with latest release. You can edit code check-in without opening Visual Studio. This is really useful to do a quick fix to your code just with a browser.
Let me show you how you could do this.
Explore a team project source code in VSO Web Portal and click on a file.
Click on edit will load the edit mode.
Add comments and check in (undo check out also possible)


Changeset can be viewed and file changes can be compared.
It is possible to add new files, upload new files and rename files as well.

Note: Code in above green box is manually added by me :).
You will find this feature is really useful to do quick fixes to code from wherever you are and whatever the device you use as long as you have a browser that can run VSO.
Currently this feature is not available for TFS on premise (2013.4), but will be available with a future update.

Saturday 27 December 2014

Trend Charts

This cool feature has been in Visual Studio Online for some time and came to TFS on premises with 2013.4. Today I am going to show with a simple example “how much useful this feature is”.
Below query is written to view all Bug work items.
This returns all Bugs with the state.
Saved the above query as a shared query and created a Trend Chart.
Chart configured to show the trend of Bug work item state, for last four weeks.
The above chart revealed really interesting information. In the first two weeks in December Team has worked hard to get as much as bugs before the holiday season. Since the holidays started Bug closing trend stopped. New Bugs slowly adding in the holiday season as well since clients are also adding Bugs. Resolving and Activation of bugs came into a halt as well with the start of holidays. Above is really awesome information for the team when they come after holidays.
By pinning this chart to Team Project home page, team will know by a quick glance at the chart, they have lot of Bugs in the backlog, to be fixed in the new year. So team can put their effort to maximum with a fast forward gear to resolve and close the Bugs as soon as possible.
Trend charts supporting longer time than last four weeks (last 12 weeks, last year) are already available with VSO (Visual Studio Online) and this will be available for on premises TFS in a future update.

Monday 22 December 2014

TFS Backup/Restore – Lessons Learnt

I was upgrading a TFS from 2012.2 to 2013.4 today and came across unexpected situations in backing up and restoring DBs. Thought worth sharing my experience to anyone else doing upgrades might easily do these mistakes.

Lesson 1
I have done a trial upgrade before today’s live upgrade and used TFS admin console backup schedule to take a manual scheduled full backup of TFS. This was a hardware migration upgrade and worked fine for the trial. Today when I started actual upgrade I took the TFS offline by executing “TFSServiceControl quiesce” and “net Stop WAS” commands. After that as in trial I started the scheduled backup manually from TFS admin console.
After about 30 minutes nothing happened. No backups were created in the path specified. This is when me and my colleagues realized this could be because we have taken the TFS services offline (it was necessary to take it offline to make sure no team members from three global offices access the current TFS while upgrade going on, so we can assure no data new TFS production).
We started TFS services again using “TFSServiceControl unquiesce” and “net start WAS” followed by a “iisreset”. Suddenly backups started getting created. So it is confirmed TFS services specially Job Agent Service should be running to get backups via admin console scheduled backups. Since we wanted to take TFS offline we did take it offline again, and took manual DB backups. Including backing up Reporting Services key as well. List of items we backed up is below for reference. ( Bad thing was we lost about one hour of the planned schedule)
All Collection DBs
Tfs_Analysis DB
Tfs_Warehouse DB
ReportServer DB
ReportServerTemp DB
Reporting Services key

Lesson 2
The second one was a bit of unfortunate situation. While we were taking down build servers etc we have seen a notification of windows update. We did not consider it would affect our work since we had seen nothing in the intermediate machine we have used to do the upgrade. We took backups of all TFS DBs and started restoring them in a intermediate server to run the upgrade before moving database to new production hardware. One collection DB out of six collection DBs having size of 182 GB was the largest. While we were restoring it in the SQL 2008 R2 SP1 (Simulating current production TFS environment) took around two hours to reach 80% restore completion and suddenly crashed. The error message was SQL services not found. When checked found SQL Server is down. Reason was a windows update has shut down the service of SQL while restore operation is going on. Disabled windows updates, and restarted restore DBs.This cost us 2 additional hours.

Friday 19 December 2014

TFS Job History –View Success Jobs

TFS Job monitoring is possible using https://YourTFSServer/tfs/_oi . More information on this can be found on here.
I have had a look at this and found some indications of failures.
When I have a look at Job history I see the failure jobs.
Job history shown here says successful jobs are not shown. and there is no way to filter and see them in here.
“The grid below shows the job history results over the stated period of time (up to 500 entries). Below is the list of filters which may be limiting the data which is returned. By default, the successful jobs ARE NOT shows to minimize distractions when reviewing the results.”
I thought there should be a way to see them since it is coming from TFS Databases for sure. Ok what I am going to explain below is how to view success jobs as well, but this is accessing TFS DB, make sure not to change any data here. View information would not harm anything :)
First I needed to find the Job I am interested in “LabManager VMM Server Background Synchronization Job”. I went through the tables of TFS_Configuration database and found a “tbl_JobDefinition” table but the job was not there. Then I decided to explore each collection DB and there was another “tbl_JobDefinition”. I executed below query on that and found the Job Definition.
Query 1
SELECT TOP 1000 [PartitionId]
  FROM  [dbo].[tbl_JobDefinition]
  WHERE [JobName] = 'LabManager VMM Server Background Synchronization Job'
Executed above for each collection and found that the jobid has same GUID for all the collections.
There was no Job History table in collection DBs. But in TFS_Configuration there is one. When tried with the GUID for “LabManager VMM Server Background Synchronization Job”, found the job history there, all successful and unsuccessful for the last one month period.
Query 2
SELECT TOP 1000 [HistoryId]
  FROM [Tfs_Configuration].[dbo].[tbl_JobHistory]
  where [JobId] = '1039066B-8187-4831-BCB5-CFC981D98140'
  order by [StartTime] asc
I thought the Job Source should be the collection, Modified the query to link with “tbl_CatalogServiceReference, ”“tbl_CatalogResource” and “tbl_CatalogResourceType” got it confirmed.
Query 3
SELECT        TOP (1000) H.HistoryId,
                CR.DisplayName AS Resource,
                CRT.DisplayName AS [Resource Type]
FROM            [Tfs_Configuration].dbo.tbl_JobHistory H
                    INNER JOIN
                         [Tfs_Configuration].dbo.tbl_CatalogServiceReference CSR
                         ON CSR.ServiceIdentifier = H.JobSource
                         INNER JOIN
                         [Tfs_Configuration].dbo.tbl_CatalogResource CR
                         ON CSR.ResourceIdentifier = CR.Identifier
                         INNER JOIN
                         [Tfs_Configuration].dbo.tbl_CatalogResourceType CRT
                         ON CRT.Identifier = CR.ResourceType
WHERE        (H.JobId = '1039066B-8187-4831-BCB5-CFC981D98140')
ORDER BY H.StartTime
If you are trying this out REMEMBER you are accessing TFS configuration and collection DBs. So BE CAREFUL not to edit any data.

Saturday 13 December 2014

Show/Hide Work Item Field Based on Value in Another Field

Is it possible? To show/hide work item field based on value in another field. Answer is yes and no. Let me show you why and how.
Let’s create a condition field with two options
Next we’ll create a second field which is using WHEN condition with READONLY is the vale in condition field is NotEditable.
Add the two fields to Form like below and we’ll see how it works
When the second field is having no value (empty) then it is hidden when selected “NotEditable” in condition field and shows when it is selected “Editable” in condition field.
When you have a value in the second field it is set to readonly and editable mode instead of hide and show.
If you want to handle multiple values in condition field, and some of them set the second field show-hide/readonly-editable you can do it as shown below.

Popular Posts