Prevent incorrect namespace from breaking your REPL

Fixes #849 

Thanks to the Roslyn APIs, this requires reflection to modify an immutable, private field :)
The problem does not appear on Mono due to different namespace handling there, however once Mono error reporting is improved (there is a separate issue for that) we will have to handle that there too.
ah I somehow inferred you say just return the field since it's IEnumerable.
I am not sure you get any benefits with iterator here though, have a look
at James' article
http://geekswithblogs.net/BlackRabbitCoder/archive/2010/11/04/c.net-fundamentals-returning-an-immutable-collection.aspx
he manages to conclude ToArray is superior than an iterator unless you deal
with massive collections :)

On 11 November 2014 17:05, Adam Ralph <notifications@github.com> wrote:

> In src/ScriptCs.Contracts/ScriptResult.cs:
>
> > @@ -44,6 +57,14 @@ public ScriptResult()
> >
> >          public ExceptionDispatchInfo CompileExceptionInfo { get; private set; }
> >
> > +        public IEnumerable<string> InvalidNamespaces
> > +        {
> > +            get
> > +            {
> > +                return _invalidNamespaces.ToArray();
>
> return _invalidNamespaces.Select(_ => _); will also give immutability
> since it will just yield out each member of the HashSet, one by one.
>
> Anyway, this is minor. It's not like there will be 100,000 invalid
> namespaces. Or at least I hope not [image: :wink:]
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/scriptcs/scriptcs/pull/850/files#r20159321>.
>