Bug ? Turning warning into errors...

Hi all !

I think I ran into some VS/Mono related bug. Here is a piece of code with 2 snippets that are doing the same thing. In case 1 the condition of the where is checking two booleans against each other, in case 2 it is just a single boolean.
What happen is that if I use code 1, then unity start treating all my warning as errors and I cannot run game anymore. If I use 2 everything is fine.
I would thank any explanation for this behavior that I do not understand ^^'…

(note: the boolean isCorrect is not always true, it is just for illustration purpose)

                            bool isCorrect = true;
                            //1 - This is creating a problem
iconMatch.sprite = (from m in MappingManager.Instance.m_boolean where (m.isRight == isCorrect) select m.sprite).First();
                            //2 - This is working fine
if (isCorrect)
                                iconMatch.sprite = (from m in MappingManager.Instance.m_boolean where m.isRight select m.sprite).First();
                            else
                                iconMatch.sprite = (from m in MappingManager.Instance.m_boolean where !m.isRight select m.sprite).First();

Do you by any chance have an “Internal Compiler Error” logged anywhere?

No, the thing is that Visual Studio compile the project just fine. But when it comes to running it within unity I get warning reported as errors. And only one (if I fix it then the next one appears as an error and so on.)

I just noticed an additional fact:
the problem only appears if the instruction is contained within a lambda expression…

In my experience, when Unity starts reporting warnings as errors, it means:

  1. You’ve specifically asked warnings to be treated as errors (which you don’t appear to have)
  2. Unity’s compiler has encountered an internal error, and all warnings discovered to that point appear as errors

It sounds like you’ve run into the second case – sometimes the compiler will attach the “internal compiler error” to the actual warning stack trace. Can you post the stack trace from one of your warnings that is being seen as an error?

Oh… Ok, I did not know that. Here it is…
From googling it seems quite likely that there is some problem with this syntax and mono