locked
Failed to resolve profiler path from COR_PROFILER_PATH and COR_PROFILER environment variables RRS feed

  • Question

  • Hi,

    I am receiving below exception while trying to execute test using ShimsContext.

    Here is more information about the environment - 

    1. Tests are using the Visual Studio Test Runner using Test Explorer

    2. .testsettings file is NOT used

    3. Tests were running fine until fakes files were centralized and a link was added to the test project

    This was done in order to avoid Build overriding the .fakes files if multiple projects faked the same assembly. The requirement was to maintain .fakes files at one location only.

    4. Tests run perfectly when run individually (by selecting a test and clicking run selected test), but fail when using "Run All"

    Any help would be appreciated.

    Test Name:             abc

    Test FullName:       test.cs

    Test Source:            test.cs : line 32

    Test Outcome:        Failed

    Test Duration:         0:00:00.0268971

     

    Result Message:    

    Test method abc threw exception:

    Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Failed to resolve profiler path from COR_PROFILER_PATH and COR_PROFILER environment variables.

    Result StackTrace: 

    at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.IntelliTraceInstrumentationProvider.ResolveProfilerPath()

       at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.IntelliTraceInstrumentationProvider.Initialize()

       at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.InitializeUnitTestIsolationInstrumentationProvider()

       at Microsoft.QualityTools.Testing.Fakes.Shims.ShimRuntime.CreateContext()

       at Microsoft.QualityTools.Testing.Fakes.ShimsContext.Create()

       at Microsoft.IT.Ais.UnitTest.ResubmissionTest.InboundUrlTrackingDbProviderTest.GetInboundUrlToResubmitByRequestIdTest()


    • Moved by Cece Dong Wednesday, November 12, 2014 6:58 AM from TFS
    Tuesday, November 11, 2014 9:49 PM

Answers

  • Hi All

    Apologies for responding in after quite some time. This post here explains the issue and a few solutions, though they did not work out quite well for me.

    We have decided in the meantime to wait for our project to be migrated to VS 2013, where the dependency on these environment variables has been eliminated, hence will resolve the issue by itself.

    Thanks a lot everyone for chiming in!

    Thanks,

    Abhishek


    • Marked as answer by Amanda Zhu Monday, December 8, 2014 1:52 AM
    Friday, December 5, 2014 7:26 PM

All replies

  • Hi,

    Thanks for your post.

    It seems that your issue is more related to Unit Testing, I moved your case to Unit Testing forum for better response. Thanks for your understanding.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, November 12, 2014 7:00 AM
  • Hi Ghost288,

    Please run the two test methods together through 'Run All' option in Test Explorer to check whether the same issue will occur, it will help to narrow down this issue to Visual Studio itself or your specific test solution:

    using System;

    using Microsoft.VisualStudio.TestTools.UnitTesting;

    using Microsoft.QualityTools.Testing.Fakes;

    namespace UnitTestProjectfortemp1

    {

        [TestClass]

        public class UnitTest1

        {

            [TestMethod]

            public void TestMethod1()

            {

                using (ShimsContext.Create()) { }

            }

            [TestMethod]

            public void TestMethod2()

            {

                using (ShimsContext.Create()) { Console.Write("test"); }

            }

        }

    }

    In addition, what version of VS are you using?


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.




    • Edited by Amanda Zhu Friday, November 21, 2014 1:40 AM edit
    Wednesday, November 12, 2014 7:26 AM
  • Hi Ghost288,

    What about your issue now?

    If you have resolved it, you can share the solution here, which will be beneficial for other members with the same issue.

    If you did not, please tell us the result of my suggestion, I will try my best to help you.

    Best regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, November 17, 2014 2:09 AM
  • Hello, as I have exactly the same error as described by GHost288, BUT with the difference, that my unit test even fails when it runs individually, I did what you suggested and ran your 2 test methods (TestMethod1, TestMethod2) together.

    The problem is still the same, BOTH tests are failing with this errors:

    Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Failed to resolve profiler path from COR_PROFILER_PATH and COR_PROFILER environment variables.
    Result StackTrace:
    at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.IntelliTraceInstrumentationProvider.ResolveProfilerPath()
       at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.IntelliTraceInstrumentationProvider.Initialize()
       at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.InitializeUnitTestIsolationInstrumentationProvider()
       at Microsoft.QualityTools.Testing.Fakes.Shims.ShimRuntime.CreateContext()
       at Microsoft.QualityTools.Testing.Fakes.ShimsContext.Create()
       at Rts.Els.UI.Topologie.UI.Process.Test.TriggerTransferStreetsFromE80ToELSTest.TestMethod1() in 

    I only have this problem with a NEWLY CREATED unit test today (I guess it is connected to vs update 4 in any way).

    Older unit tests are still working, although I had issues with the Microsoft.QualityTools.Testing.Fakes.dll assembly. It seems there was a release of a newer assembly (located in "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies\"), whereas the elder one was/is located in "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ReferenceAssemblies\", but with the same version assembly/file version. However, I got it working after rereferencing the newer assembly and rebuilding all fakes and test projects.

    Thanks in advance,
    Martin Eisler

    Monday, November 24, 2014 8:35 PM
  • Hiho,

    I found the problem and fixed it today. The problem was, that I'm, referencing the Faked assemblies from an external project (to prevent recreation of fake assemblies on every test change) and therefore missed a reference to "mscorlib.4.0.0.0.Fakes.dll". I thought, that the mscorlib was created due to creation of fake assembly from System.dll, but it seems it is added/created when ANY fakes assembly is automatically created. Hence it's obviously needed for the fakes environment and in the test runner too!

    I just referenced the "mscorlib.4.0.0.0.Fakes.dll" assembly in my new unit test project and the exception for missing COR_PROFILER_PATH and COR_PROFILER environment variables was gone.

    Best regards,
    Martin


    • Proposed as answer by RTS Martin Eisler Tuesday, November 25, 2014 11:10 AM
    • Edited by RTS Martin Eisler Tuesday, November 25, 2014 11:57 AM
    • Marked as answer by Amanda Zhu Friday, November 28, 2014 9:19 AM
    • Unmarked as answer by Amanda Zhu Monday, December 8, 2014 1:53 AM
    Tuesday, November 25, 2014 11:10 AM
  • Hi Ghost288,

    Martin provided his solution for such error. You can reference it to check whether it can help you.

    For any update, please feel free to come back.

    Thanks,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, November 26, 2014 2:19 AM
  • Hi All

    Apologies for responding in after quite some time. This post here explains the issue and a few solutions, though they did not work out quite well for me.

    We have decided in the meantime to wait for our project to be migrated to VS 2013, where the dependency on these environment variables has been eliminated, hence will resolve the issue by itself.

    Thanks a lot everyone for chiming in!

    Thanks,

    Abhishek


    • Marked as answer by Amanda Zhu Monday, December 8, 2014 1:52 AM
    Friday, December 5, 2014 7:26 PM
  • Hi Abhishek,

    Thank you for your response. Then I will close this thread.

    Have a nice day:)


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, December 8, 2014 1:52 AM