﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Nexus commented on Breaking the C# compiler, again</title><description>"I just think you're idiot. That's why it keeps crashing. Reading your posts reveal complete lameness and idiocy. You're doing things the hard way and you're thinking the universe spins around you. That said - you're idiot. " 
  
  
--&gt; humpbacked lout : Maybe you should rethink that statement with the following in mind: If you don't understand maybe you're idiot, and stop reading this blog.
</description><link>http://ayende.com/4581/breaking-the-c-compiler-again#comment18</link><guid>http://ayende.com/4581/breaking-the-c-compiler-again#comment18</guid><pubDate>Thu, 12 Aug 2010 13:07:52 GMT</pubDate></item><item><title>humpbacked lout commented on Breaking the C# compiler, again</title><description>I just think you're idiot. That's why it keeps crashing. Reading your posts reveal complete lameness and idiocy. You're doing things the hard way and you're thinking the universe spins around you. That said - you're idiot.
</description><link>http://ayende.com/4581/breaking-the-c-compiler-again#comment17</link><guid>http://ayende.com/4581/breaking-the-c-compiler-again#comment17</guid><pubDate>Thu, 12 Aug 2010 06:40:22 GMT</pubDate></item><item><title>Bob commented on Breaking the C# compiler, again</title><description>MAkes sure project target is set to .net 4.0?
</description><link>http://ayende.com/4581/breaking-the-c-compiler-again#comment16</link><guid>http://ayende.com/4581/breaking-the-c-compiler-again#comment16</guid><pubDate>Wed, 11 Aug 2010 06:48:04 GMT</pubDate></item><item><title>configurator commented on Breaking the C# compiler, again</title><description>Interesting, the lambda-syntax fails here too.
  
  
This doesn't compile:
  
var q = docs.SelectMany(doc =&gt; doc.AssociatedEntities);
  
Neither does this:
  
var q2 = docs.SelectMany((dynamic doc) =&gt; doc.AssociatedEntities);
  
Both with the same error: 'object' does not contain a definition for 'AssociatedEntities' and no extension method 'AssociatedEntities' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
  
  
However this works:
  
var q = docs.Where(doc =&gt; doc.AssociatedEntities != null);
  
  
So you can absolutely use dynamic as lambda parameters. Sometimes.
</description><link>http://ayende.com/4581/breaking-the-c-compiler-again#comment15</link><guid>http://ayende.com/4581/breaking-the-c-compiler-again#comment15</guid><pubDate>Tue, 10 Aug 2010 19:34:10 GMT</pubDate></item><item><title>13xforever commented on Breaking the C# compiler, again</title><description>It seems like MS have a lot to fix in their c# 4.0 compiler that is dealing with dynamics.
  
  
'Cause as simple code as this will crash the compiler:
  
  
using System;
  
using System.Collections.Generic;
  
  
namespace ExcelToRavenDbExporter
  
{
  
    using TConverter = Dictionary
&lt;string,&gt;
&gt;;
  
  
    internal class Program
  
    {
  
        private static void Main()
  
        {
  
        }
  
    }
  
} 
  
</description><link>http://ayende.com/4581/breaking-the-c-compiler-again#comment14</link><guid>http://ayende.com/4581/breaking-the-c-compiler-again#comment14</guid><pubDate>Tue, 10 Aug 2010 18:24:58 GMT</pubDate></item><item><title>Elroy commented on Breaking the C# compiler, again</title><description>My day-job includes developing a compiler and I can so well relate to this scenario. But, of course, we're talking about VS here. You would obviously expect a lot from the compiler.
</description><link>http://ayende.com/4581/breaking-the-c-compiler-again#comment13</link><guid>http://ayende.com/4581/breaking-the-c-compiler-again#comment13</guid><pubDate>Tue, 10 Aug 2010 17:40:29 GMT</pubDate></item><item><title>tobi commented on Breaking the C# compiler, again</title><description>Obviously a compiler bug as the transparent identifier class names should never be visible. On stack overflow you can find other C# compiler bugs and even bugs in the Jitter. I personally have only hit one single compiler bug in C# at all. Cant complain about Microsofts quality standards at all (in which product or lib that you are using for five years have you found &lt;= 1 bug?).
</description><link>http://ayende.com/4581/breaking-the-c-compiler-again#comment12</link><guid>http://ayende.com/4581/breaking-the-c-compiler-again#comment12</guid><pubDate>Tue, 10 Aug 2010 17:16:01 GMT</pubDate></item><item><title>Scubastard commented on Breaking the C# compiler, again</title><description>I think I saw a Rob Conery post where he details issues with dynamic C# classes/properties not being able to be resolved with extension methods. Sounds like thats related to whats happening here and as a result your linq extension methods can no longer be found... thats just a wild guess though.
</description><link>http://ayende.com/4581/breaking-the-c-compiler-again#comment11</link><guid>http://ayende.com/4581/breaking-the-c-compiler-again#comment11</guid><pubDate>Tue, 10 Aug 2010 14:15:31 GMT</pubDate></item><item><title>Tom Pester commented on Breaking the C# compiler, again</title><description>The compiler rewrites the syntactic sugar that are query expression to (extension) method calls. This is an early pass that the compiler does to get to plain vanilla c# statements.
  
  
I think the parser gets seriously confused by your line 8 probably in comination with previous build up state. 
  
  
What happens if your rewrite the query expression to plain method calls?
</description><link>http://ayende.com/4581/breaking-the-c-compiler-again#comment10</link><guid>http://ayende.com/4581/breaking-the-c-compiler-again#comment10</guid><pubDate>Tue, 10 Aug 2010 13:12:52 GMT</pubDate></item><item><title>D. P. Bullington commented on Breaking the C# compiler, again</title><description>@David Cuccia I hope that was in reference to:
  
  
"Ayende is not your helpdesk"
  
  
It goes both ways.
  
  
:)
</description><link>http://ayende.com/4581/breaking-the-c-compiler-again#comment9</link><guid>http://ayende.com/4581/breaking-the-c-compiler-again#comment9</guid><pubDate>Tue, 10 Aug 2010 12:47:46 GMT</pubDate></item><item><title>FallenGameR commented on Breaking the C# compiler, again</title><description>Stupid question.... =) dynamic is in 4.0 and 4.0 is in 2010.
  
Anyway, the code you provided doesn't crush on my side.
</description><link>http://ayende.com/4581/breaking-the-c-compiler-again#comment8</link><guid>http://ayende.com/4581/breaking-the-c-compiler-again#comment8</guid><pubDate>Tue, 10 Aug 2010 08:10:17 GMT</pubDate></item><item><title>FallenGameR commented on Breaking the C# compiler, again</title><description>And Studio 2010 says the same error as LinqPad.
  
What studio &amp; target framework are you using?
</description><link>http://ayende.com/4581/breaking-the-c-compiler-again#comment7</link><guid>http://ayende.com/4581/breaking-the-c-compiler-again#comment7</guid><pubDate>Tue, 10 Aug 2010 08:08:46 GMT</pubDate></item><item><title>FallenGameR commented on Breaking the C# compiler, again</title><description>When I ran the query in the LinqPad, I get following error on line 5 (before your error):
  
  
5: from entity in doc.AssociatedEntities
  
  
An expression of type 'dynamic' is not allowed in a subsequent from clause in a query expression with source type 'System.Collections.Generic.IEnumerable
&lt;dynamic'.  Type inference failed in the call to 'SelectMany'.
&gt;</description><link>http://ayende.com/4581/breaking-the-c-compiler-again#comment6</link><guid>http://ayende.com/4581/breaking-the-c-compiler-again#comment6</guid><pubDate>Tue, 10 Aug 2010 08:06:22 GMT</pubDate></item><item><title>Ayende Rahien commented on Breaking the C# compiler, again</title><description>FallenGameR,
  
The issue is in the _compiler_, not at runtime
</description><link>http://ayende.com/4581/breaking-the-c-compiler-again#comment5</link><guid>http://ayende.com/4581/breaking-the-c-compiler-again#comment5</guid><pubDate>Tue, 10 Aug 2010 07:58:57 GMT</pubDate></item><item><title>FallenGameR commented on Breaking the C# compiler, again</title><description>Try to attach Reflector Pro - it can step into Framework assemblies.
</description><link>http://ayende.com/4581/breaking-the-c-compiler-again#comment4</link><guid>http://ayende.com/4581/breaking-the-c-compiler-again#comment4</guid><pubDate>Tue, 10 Aug 2010 07:57:33 GMT</pubDate></item><item><title>David Cuccia commented on Breaking the C# compiler, again</title><description>Sounds like a good SO question.
</description><link>http://ayende.com/4581/breaking-the-c-compiler-again#comment3</link><guid>http://ayende.com/4581/breaking-the-c-compiler-again#comment3</guid><pubDate>Tue, 10 Aug 2010 03:06:14 GMT</pubDate></item><item><title>Dmitry commented on Breaking the C# compiler, again</title><description>Have you tried writing (retyping) the same code in another file. I had a couple of weird issues with whitespace that was a result of copying-and-pasting.
</description><link>http://ayende.com/4581/breaking-the-c-compiler-again#comment2</link><guid>http://ayende.com/4581/breaking-the-c-compiler-again#comment2</guid><pubDate>Tue, 10 Aug 2010 00:52:55 GMT</pubDate></item><item><title>Steve Py commented on Breaking the C# compiler, again</title><description>Simple options that come to mind: What happens if you break that query down into separate queries?
  
  
Have you tried setting up to debug into the ,Net source? It might be easier to step through with the extension method syntax:
  
var q = docs.Where(doc =&gt; doc["@metadata"]["Raven-Entity-Name"] == "Cases" &amp;&amp; doc.AssociatedEntities != null)
  
.SelectMany( doc =&gt; doc.AssociatedEntities)
  
.Where(entity =&gt; entity.Tags != null)
  
.SelectMany(entity =&gt; entity.Tags)
  
.Where(tag =&gt; tag.ReferencedAggregate != null)
  
.Select (tag =&gt; new {tag.ReferencedAggregate.Id, doc.__document_id});
  
  
Should compile down to effectively the same operations, I just find the extension syntax more consistent to follow in code.
</description><link>http://ayende.com/4581/breaking-the-c-compiler-again#comment1</link><guid>http://ayende.com/4581/breaking-the-c-compiler-again#comment1</guid><pubDate>Tue, 10 Aug 2010 00:51:38 GMT</pubDate></item></channel></rss>