Answered TestContext warning cs1684

  • Wednesday, April 11, 2012 7:02 PM
     
     

    I create a new "Windows Metro style" Unit Test Library project. I compile it and I get no warnings.

    I then modify the test class to include:

    public TestContext TestContext {get;set;}

    Then, I re-compile. After that I always get two warnings:

    1>c:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\MSTestFramework\11.0\References\CommonConfiguration\neutral\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll : warning CS1684: Reference to type 'System.Collections.IDictionary' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\mscorlib.dll', but it could not be found

    1>c:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\MSTestFramework\11.0\References\CommonConfiguration\neutral\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll : warning CS1684: Reference to type 'System.Collections.IDictionary' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\mscorlib.dll', but it could not be found

    How do I get rid of these warnings?

All Replies

  • Friday, April 13, 2012 10:32 AM
    Moderator
     
     

    Hello Michael,

    Do you reference the mscorlib.dll in your test project? If so, which mscorlib.dll you add in your test project? Is the one in the path C:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\ or the one in the path c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\?

    I suspect you are using the c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\mscorlib.dll in your test project. However, I am sorry to say that you can't find the 'System.Collections.IDictionary' type in the c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\mscorlib.dll. Instead you can find it in the  C:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll. So I am afraid you need to re-add your reference.

    Thanks. 


    Vicky Song [MSFT]
    MSDN Community Support | Feedback to us

  • Friday, April 13, 2012 3:24 PM
     
     

    I didn't add any references. The references to the project are:

    • .NET for Metro style apps
    • MSTestFramewor
    • TestPlantform
    • Windows

    These are the exact steps I followed.

    1. Open Visual studio with no solutions.
    2. Create a new project. Select Visual C# -> Windows Metro Style -> Blank Application
    3. Accept all defaults, press OK.
    4. Right click on the solution to add a project.
    5. Selected Visual C# -> Windows Metro Style -> Unit Test Library
    6. Kept the defaults, and pressed OK.
    7. Build solution - no errors or warnings.
    8. Added the TestContext property to the UnitTest1 class (final code below).
    9. Build solution – warnings are present.

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    using Microsoft.VisualStudio.TestTools.UnitTesting;

    namespace UnitTestProject1

    {

        [TestClass]

        public class UnitTest1

        {

            public TestContext TestContext { get; set; }

            [TestMethod]

            public void TestMethod1()

            {

            }

        }

    }

  • Monday, April 16, 2012 5:02 AM
    Moderator
     
     

    Hello Michael,

    Thanks for providing me the detailed steps, and I can reproduce it. I am sorry that I can't figure you the root cause of your issue. Maybe you can consider submitting one feedback on the Microsoft Connect site here:

    https://connect.microsoft.com/VisualStudio/feedback/CreateFeedback.aspx 

    Thanks.


    Vicky Song [MSFT]
    MSDN Community Support | Feedback to us

  • Wednesday, April 18, 2012 2:15 PM
     
     Answered