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?
- Moved by Mike WongMicrosoft Employee, Owner Wednesday, April 11, 2012 9:11 PM (From:Building Metro style apps with C# or VB )
All Replies
-
Friday, April 13, 2012 10:32 AMModerator
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.
- Open Visual studio with no solutions.
- Create a new project. Select Visual C# -> Windows Metro Style -> Blank Application
- Accept all defaults, press OK.
- Right click on the solution to add a project.
- Selected Visual C# -> Windows Metro Style -> Unit Test Library
- Kept the defaults, and pressed OK.
- Build solution - no errors or warnings.
- Added the TestContext property to the UnitTest1 class (final code below).
- 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 AMModerator
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
Thanks Vicky,
The problem was posted on Microsoft Connect at:
https://connect.microsoft.com/VisualStudio/feedback/details/750518/targetexception-error-in-binding-to-dictionary-string-object- Marked As Answer by Michael Lemley Wednesday, April 18, 2012 2:15 PM
- Edited by Michael Lemley Friday, June 22, 2012 8:54 PM

