I wrote unit test on a piece of code that returned JSON. The type that it returns is an anonymous type, so I decided to check the values ββon it. I just applied the object to dynamic to fulfill my statements.
However, when I do this, my build fails, but I have no error messages. I was able to reproduce this with very simple code in a new unit test project:
[TestMethod] public void TestMethod1() { var obj = new { someValue = true }; dynamic asDynamic = obj; Assert.IsTrue(asDynamic.someValue); }
Below is a screenshot of a build error

The line completes successfully when I comment on this statement:

In contrast, I ran the following code in the beta version of LinqPad 5 (which uses the Roslyn compiler) and had no problems:
var obj = new { someValue = true }; dynamic asDynamic = obj; Console.WriteLine((asDynamic.someValue == true).ToString());
True
What's going on here? Since the error does not appear, I cannot say if I am using dynamic incorrectly, or if it cannot find the overload used for IsTrue() due to dynamic , or if it is an error in the compiler (although I really doubt it, I have there is no evidence that something is wrong with my code).
Regarding the overload problem, I tried Assert.IsTrue((bool)asDynamic.someValue); but the assembly still fails but no error message appears.
In @RonBeyer's comment, I also tried more casting, like below, to no avail:
dynamic asDynamic = (dynamic)obj; Assert.IsTrue(((dynamic)asDynamic).someValue); Assert.IsTrue((bool)asDynamic.somevalue);
Upon closer inspection, I found that an error occurred in the output window:
c: ... \ DynamicBuildFailTest \ UnitTest1.cs (16,33,16,42): error CS0656: missing compiler, required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'
Well, VS2013 is better to report errors, I will search based on these:

Well, adding a link to Microsoft.CSharp fixed the build error , but I will leave this question open, because this is apparently a problem with VS2015, which (in my opinion) should be resolved.