But it works on my PC!

The random thoughts of Richard Fennell on technology and software development

Problems with uplink on an 8 port Netgear Gigabit switch

All the ports on the Netgear GS608 I think are meant to be auto speed and uplink sensing, I have found this not to be true. I had the 1Gb uplink to our central switches in Port 8 and a 100Mb Ethernet workstation in port 2 could not get an IP address via DHCP. When I moved the uplink to Port 1 it all leapt into life. Interestingly other 1Gb PCs in other ports had no problem with the uplink in either port 1 or 8.

So my tip is put you uplink in port 1 on a Netgear switch to avoid problems with auto sensing.

.NET Framework 3.5 SP1 issue on Windows SharePoint Services v2.0

If you apply the TFS2008 SP1 to a system that has been upgraded from TFS 2005, but the WSS was not upgraded from 2.0 to 3.0 you can get a problem that you cannot access the SharePoint portal sites due to WebPart load errors (you get an Event ID: 1000 error in the Windows event logs). This is because the TFS 2008 SP1 installs .NET framework 3.5 SP1 which causes some problems for WSS 2.0. Note this is not usually a problem for new installs of TFS 2008 as these use WSS 3.0 by default, but the upgrade of TFS from 2005 to 2008 does not force the upgrade of WSS 2.0 to 3.0 so sites that upgraded are susceptible.

Most of the blog posts suggest a removal of .NET 3.5 and reinstall of 2.0 with service packs, this is not an option for a TFS 2008 installation. Luckily there is a solution, the .NET framework family update. Once these patches are installed for the historic versions of .NET all seems OK

Thanks to Wes MacDonald for pointing me at this fix, saved me no end of headaches

Logging everything that is going on when an assembly loads using CThru

Whist trying to work out if there is any way to get around the problem I am suffering with Sharepoint workflows idling inside a Typemock Isolator test harness I have been having a good look at CThru; a set if libraries for Typemock that, and I quote Codeplex here, ‘… allows creating interception and isolation frameworks for logging, testing and many other things very simply’. This is the framework is used to create the Silverlight mocking frame work on the same Codeplex site.

To aid my analysis I wrote a basic Logger using the Aspect concepts of CThru, which I call as follows:

// set the name of the types I want to monitor
TestProject.LoggingAspect.TypeNamesToMatch.Add("SharePoint");
// tell it where to look for aspects
CThru.CThruEngine.AddAspectsInAssembly(System.Reflection.Assembly.GetExecutingAssembly());
// and start it up
CThru.CThruEngine.StartListening();

The source is below is just included in my assembly, it allow me to chose if I want to log as text for CSV format. I am sure it will need editing for your logging needs but it gives you the basic idea….

using System;
using CThru;
using System.Diagnostics;
using System.Collections.Generic;
using System.Text;
 
namespace TestProject
{
    /// <summary>
    /// A sample Aspect logger for CThru
    /// </summary>
    class LoggingAspect : Aspect
    {
        /// <summary>
        /// The current logger in use
        /// </summary>
        private static IAspectLogger logger  = new DebugTextLogger() ;
 
        /// <summary>
        /// A list of the available logging formats
        /// </summary>
        public enum LoggingMethod
        {
            TextToDebug,
            CommaSeparatedToDebug
        }
 
        /// <summary>
        /// The list of string to do partial matches against when logging
        /// If any string in this list is in the namespace or typename it gets logged
        /// If this list is empty then all types are logged
        /// </summary>
        public static List<string> TypeNamesToMatch = new List<string>();
 
        /// <summary>
        /// Sets the current logging format
        /// </summary>
        public static LoggingMethod CurrentLoggingMethod
        {
            set
            {
                switch (value)
                {
                    default:
                    case LoggingMethod.TextToDebug:
                        logger = new DebugTextLogger();
                        break;
                    case LoggingMethod.CommaSeparatedToDebug:
                        logger = new DebugCVSLogger();
                        break;
                }
 
            }
 
        }
 
        public static bool LogToCSV = false;
 
        public override void StaticConstructorBehavior(DuringCallbackEventArgs e)
        {
            LogEvent("LoggingAspect.StaticConstructorBehavior", e);
        }
 
        public override void ConstructorBehavior(DuringCallbackEventArgs e)
        {
            LogEvent("LoggingAspect.ConstructorBehavior", e);
        }
 
        public override void MethodBehavior(DuringCallbackEventArgs e)
        {
            LogEvent("LoggingAspect.MethodBehavior", e);
 
            if (e.MethodName == "StsCompareStrings")
            {
                e.MethodBehavior = MethodBehaviors.ReturnsCustomValue;
                e.ReturnValueOrException = true;
            }
 
        }
 
        public override void MissingMethodBehavior(DuringCallbackEventArgs e)
        {
            LogEvent("LoggingAspect.MissingMethodBehavior", e);
        }
 
        private static void LogEvent(string description, DuringCallbackEventArgs e)
        {
            logger.LogEvent(description, e);
        }
 
        /// <summary>
        /// The control to see which 
        /// </summary>
        /// <param name="info">The info on the currently handled assembly</param>
        /// <returns>True if we should monitor this event</returns>
        public override bool ShouldIntercept(InterceptInfo info)
        {
            if (TypeNamesToMatch.Count > 0)
            {
                foreach (string name in TypeNamesToMatch)
                {
                    // find the first match of this string in a namespace typename
                    if (info.TypeName.Contains(name) == true)
                    {
                        return true;
                    }
                }
            }
            else
            {
                // none in the list match all
                return true;
            }
            return false;
        }
 
        /// <summary>
        /// Helper method to format the parameters as a list in a string
        /// </summary>
        /// <param name="e">The handled event</param>
        /// <returns>A strung listing the params and their values</returns>
        public static string ParametersListToString(DuringCallbackEventArgs e)
        {
            var sb = new StringBuilder();
            if (e.ParameterValues != null)
            {
                for (int i = 0; i < e.ParameterValues.Length; i++)
                {
 
                    if (e.ParameterValues[i] != null)
                    {
                        sb.Append(String.Format("{0} [{1}]", e.ParameterValues[i].GetType(), e.ParameterValues[i]));
                    }
                    else
                    {
                        sb.Append("null");
                    }
                    if (i < e.ParameterValues.Length - 1)
                    {
                        sb.Append(",");
                    }
                }
            }
            return sb.ToString();
        }
 
    
 
    }
 
    /// <summary>
    /// Logger interface 
    /// </summary>
    public interface IAspectLogger
    {
       void LogEvent(string description, DuringCallbackEventArgs e);
    }
 
    /// <summary>
    /// Logs an items as plain text
    /// </summary>
    public class DebugTextLogger : IAspectLogger
    {
        public void LogEvent(string description, DuringCallbackEventArgs e)
        {
            Debug.WriteLine(string.Format("{0}: {1}{2}.{3}({4})",
                description,
                e.TargetInstance == null ? "[Static] " : string.Empty,
                e.TypeName,
                e.MethodName,
                LoggingAspect.ParametersListToString(e)));
        }
    }
 
    /// <summary>
    /// Logs an items as comma separated to ease analysis
    /// </summary>
    public class DebugCVSLogger : IAspectLogger
    {
        
        public DebugCVSLogger()
        {
            // write out a header so we know the colomns
            Debug.WriteLine(string.Format("{0},{1},{2},{3},{4}",
                "Event logged",
                "Is Static",
                "Type name",
                "Method name",
                "Parameter List...."));
        }
 
        public void LogEvent(string description, DuringCallbackEventArgs e)
        {
            Debug.WriteLine(string.Format("{0},{1},{2},{3},{4}",
                description,
                e.TargetInstance == null ? "True" : "False",
                e.TypeName,
                e.MethodName,
                LoggingAspect.ParametersListToString(e)));
        }
    }
 
 
 
}

0x800106ba Windows Defender error in Windows Vista

I was installing a new PC for a friend yesterday; after using the Easy Transfer Wizard (first time I used this and I can heartily recommend) to move their settings from their old XP system to their new Vista one I got the 0x800106ba Windows Defender error on start-up. Now there is a lot of frankly useless comments on this error on various forums, strange as the solution is simple. I suspect this is down to this issue being predominantly a problem that hits home user who are not a familiar with the internal workings of services etc. in Windows.

Anyway the solution is make sure the Defender service is set to auto-start. You get the error if it has not been started when Windows check to see if it is running, I assume as part of the security centre checks.

It is not that the forums are really wrong, they usually suggest a reinstall of Defender (which will reset the service start-up), but it is just that this is not easy to achieve on Vista where Defender is backed into the operating system not as separate install as it was in Vista.

29109 error when installing the quiescence GDR patch for TFS 2005

Whilst upgrading a single server TFS 2005 to a dual server 2008 install I hit a problem. I had installed the new 2005 Data Tier (DT) and patched it without issue. However then I tried to apply the patch VS80-KB19156-v2-x86, the Quiescence GDR patch, on the Application Tier (AT) I got the 29109 error: SQL Reporting Services configuration encountered an unknown problem. A search on the web found this is a common issue usually fixed by repeated retries! This did not work for me.

After much fiddling, I started again and cleaned down both the DT and AT. This time I made one change from the process detailed in the TFS dual server installation walkthrough – I DID NOT patch the SQL 2005 instance of Reporting Services on the AT prior to installing TFS. This time the TFS patches applied OK, I then patched SQL at the end of the installation process to bring it in line with the DT SQL patch level.

This would suggest the problem is that the TFS 2005 patches are checking for something that was set in a default SQL 2005 install but not present in one that is patched to SP3.

Anyway hope my experience saves you some time.

TFS Sharepoint Extensions on a Load Balanced Sharepoint farm

I posted yesterday about problem creating a new team project if you had missing templates on your Sharepoint server. This problem could of course be avoided if you had installed the TFS Sharepoint Extensions onto your Sharepoint server as your are meant to. However, as I have discovered it is not that easy to do if your chosen  Sharepoint system has network load balanced front ends.

The problem is that Sharepoint will replicate your MSFAGILE30.STP template between the various servers, but it will not move other TFS artefacts such as the TFSREDIRECT.ASPX in the 12 hive or setting to point to the reporting service instance in the registry. To add these other items you need to install the extensions an then run the TFSConfigwss.exe tool to edit the registry. The problem is the Extensions MSI will not complete if it detects the STP already in place (which as I said will that have been replicated by Sharepoint). The only solution I found was to cheat a bit:

  1. Run the Extensions MSI until you get the warning dialog it cannot complete
  2. In c:\program files copy the 'Team Foundation Server 2008 Sharepoint Extensions x64 Power Tool' directory
  3. Let the MSI finish, it will remove the directory, but you have a copy with the TFSconfigwss.exe tool which is probably the only thing you need.
  4. Run TFSConfigwss.exe to setup the registry.

Or you could just copy the files you need from your original Sharepoint server where you managed to install the Extensions correctly

TF30227 error when creating team projects on TFS 2008

Historically we have used the eScrum process template for our TFS team projects. However, with a view to the TFS 2010 future we have decided to moved back to the MSF Agile template. We used eScrum to provide an easy to use web based project dashboard; we now think that we can achieve the same or better in TFS 2010 using Excel’s enhanced links to TFS and Excel Services in Sharepoint.

So when I had to create a new team project today I decided to use the TFS 2008 "MSF for Agile Software Development - v4.2" template, to hopefully ease any upgrade issues. The problem was when I tried to create the team project I got the error TF30227, if I looked in the detailed log I saw:

Event Description: TF30162: Task "SharePointPortal" from Group "Portal" failed
Exception Type: Microsoft.TeamFoundation.Client.PcwException
Exception Message: TF30272: Template not found on the server

(Note that as is common with TFS the main error reported hides another error code.)

The problem was exactly as the error says, the template was missing on our central Sharepoint farm. We have been through a number of Sharepoint upgrades and relocation of our portal sites. This had meant that the TFS templates had to be reinstalled manually, this was done correctly for the eScrum template but a mistake was made for the MSF Agile one. We had installed the template with the command

Stsadm -o addtemplate -filename MSFAgile30.stp -title VSTS_MSFAgile30

when it should have been

Stsadm -o addtemplate -filename MSFAgile30.stp -title VSTS_MSFAgile

as TFS looks for a template call VSTS_MSFAgile not one called VSTS_MSFAgile30. Once this was correct the new project could be created.