Team System Developer Center > Visual Studio Team System Forums > Visual Studio Team System - Testing > Bad Bug in VS2008 - anyone know if reported or status?
Ask a questionAsk a question
 

AnswerBad Bug in VS2008 - anyone know if reported or status?

  • Wednesday, January 02, 2008 8:33 PMjohnstonb Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I am calling MS on this since it's broke production badly:

     

    To reproduce.

     

    Create unit test project.

    Add a file to the project called 'msEnterpriseLibrary.config'.

     

    Add the following test in VS2005:

    [TestMethod]

    public void TestMethod1()

    {

    string path = "msEnterpriseLibrary.config";

    if (!Path.IsPathRooted(path))

    {

    path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path);

    }

    Assert.Inconclusive();

    }

     

    Add watch to AppDomain.CurrentDomain.BaseDirectory.

     

    Notice in VS2005 it points to the actual location of you msEnterpiseLibrary.config file you added.

     

    Now do the exact same test in VS2008.  Notice here that BaseDirectory points to C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE

     

    The current domain is correct in both VS2005 and VS2008, it's the implementation of the BaseDirectory that has changed and broken code.

Answers

  • Wednesday, January 02, 2008 10:45 PMJohnny Coleman MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

     

    Try adding the following ClassInitialize method to the Unit test.  

     

            [ClassInitialize]

            public static void ClassInitialize(TestContext testContext)

            {

                AppDomain.CurrentDomain.SetData("APPBASE", Environment.CurrentDirectory);

            }

All Replies

  • Wednesday, January 02, 2008 10:45 PMJohnny Coleman MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

     

    Try adding the following ClassInitialize method to the Unit test.  

     

            [ClassInitialize]

            public static void ClassInitialize(TestContext testContext)

            {

                AppDomain.CurrentDomain.SetData("APPBASE", Environment.CurrentDirectory);

            }

  • Wednesday, January 02, 2008 11:12 PMjohnstonb Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Okay, this is good, but I have like 180 test classes; is there a way to apply this to the whole solution?

     

  • Friday, January 04, 2008 8:29 PMJohnny Coleman MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     

    Unfortantely there is no way to add the ClassInitialize to the entire solution. It will have to be added to each Unit test class.

     

    It's possible that this behavior may change back to original behavior as in 2005, however if this was to happen it would not be done until SP1 for Orcas 2008 and no time frame on SP1.

  • Thursday, May 08, 2008 11:19 PMNimeX Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    You can do it in AssemblyInitialize to address that once for whole test execution. I assume you have a single namespace for all 180 test classes.

  • Tuesday, May 13, 2008 10:53 AMSagarDeshpande Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I ma getting an error "Parameter 1 should be of type MicroSoft.VisualStudio.......TestContext". However, i have already written the same code as above and i included the namespace also....

     

    The test script is not getting executed

  • Friday, May 16, 2008 9:43 PMNimeX Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Sagar,

     

    if you have migrated it from VS2005 to VS2008, probably you need to update the reference of UnitTestFramework as well. for VS2008, MS has realsed new version of it. ie. 9.0.0.0. You will find it under .NET tab of "Add Rerefernce" dialog.

    Component name is Microsoft.VisualStudio.QualityTools.UnitTestFramework.

     

    Hope this helps.

     

    -NimeX

  • Wednesday, October 15, 2008 12:17 AMDavidJS Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    This didn't work for me at all.  Is there something else I can do?

    -David Sutherland
  • Wednesday, October 15, 2008 12:18 AMDavidJS Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Pardon me.  I meant to say:

    [ClassInitialize]

            public static void ClassInitialize(TestContext testContext)

            {

                AppDomain.CurrentDomain.SetData("APPBASE", Environment.CurrentDirectory);

            }

    Doesn't work either.

    Is there anything else I can do?

    -Dave Sutherland

  • Thursday, February 12, 2009 10:59 AMY2KPRABUMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Does anyone know the end date for the fix from visualstudio 2008 team
    Y2KPRABU, MCTS,MCPD INDIA