PageRenderTime 136ms CodeModel.GetById 9ms app.highlight 92ms RepoModel.GetById 1ms app.codeStats 2ms

/Src/Compilers/CSharp/Test/Emit/CodeGen/WinRTCollectionTests.cs

https://github.com/EkardNT/Roslyn
C# | 7443 lines | 7248 code | 42 blank | 153 comment | 2 complexity | 6c30fac654fbeaf461328d7ac2aac221 MD5 | raw file
   1// Copyright (c) Microsoft Open Technologies, Inc.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.
   2
   3using System.Collections.Generic;
   4using Microsoft.CodeAnalysis.CSharp;
   5using Microsoft.CodeAnalysis.CSharp.Symbols;
   6using Microsoft.CodeAnalysis.CSharp.Syntax;
   7using ProprietaryTestResources = Microsoft.CodeAnalysis.Test.Resources.Proprietary;
   8using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
   9using Microsoft.CodeAnalysis.Test.Utilities;
  10using Roslyn.Test.Utilities;
  11using Xunit;
  12
  13namespace Microsoft.CodeAnalysis.CSharp.UnitTests.CodeGen
  14{
  15    public class WinRTCollectionTests : CSharpTestBase
  16    {
  17        private MetadataReference[] _legacyRefs = null;
  18
  19        public MetadataReference[] LegacyRefs
  20        {
  21            get
  22            {
  23                if (_legacyRefs == null)
  24                {
  25                    var list = new List<MetadataReference>(WinRtRefs.Length + 2);
  26                    list.AddRange(WinRtRefs);
  27                    list.Add(
  28                        new MetadataImageReference(
  29                            TestResources.WinRt.Windows_Languages_WinRTTest.AsImmutableOrNull(),
  30                            display: "WinRTTest"));
  31                    list.Add(
  32                        new MetadataImageReference(
  33                            ProprietaryTestResources.NetFX.v4_0_30319_17929.System_Core.AsImmutableOrNull(),
  34                            display: "SystemCore"));
  35                    _legacyRefs = list.ToArray();
  36                }
  37                return _legacyRefs;
  38            }
  39        }
  40
  41        [Fact, WorkItem(762316, "DevDiv")]
  42        public void InheritFromTypeWithProjections()
  43        {
  44            var source = @"
  45using Windows.UI.Xaml;
  46 
  47public sealed class BehaviorCollection : DependencyObjectCollection
  48{
  49  private int count;
  50 
  51  public BehaviorCollection()
  52    {
  53        count = this.Count;
  54    }
  55  
  56  public object GetItem(int i)
  57    {
  58     return this[i];
  59    }
  60}";
  61            var comp = CreateCompilationWithMscorlib45(source, references: WinRtRefs);
  62            comp.VerifyDiagnostics();
  63        }
  64
  65        [Fact]
  66        public void IVectorProjectionTests()
  67        {
  68            var source =
  69@"using System;
  70using Windows.Data.Json;
  71
  72public class Class1
  73{
  74    public static void Main(string[] args)
  75    {
  76        var jsonArray = new JsonArray();
  77        var a = JsonValue.CreateStringValue(""a"");
  78        jsonArray.Add(a);
  79        var b = JsonValue.CreateStringValue(""b"");
  80        jsonArray.Insert(0, b);
  81        jsonArray.Remove(b);
  82        Console.WriteLine(jsonArray.Contains(b));
  83        Console.WriteLine(jsonArray.IndexOf(a));
  84        jsonArray.RemoveAt(0);
  85        Console.WriteLine(jsonArray.Count);
  86        jsonArray.Add(b);
  87        foreach (var json in jsonArray)
  88        {
  89            Console.WriteLine(json.GetString());
  90        }
  91        Console.WriteLine(jsonArray.Count);
  92        jsonArray.Clear();
  93        Console.WriteLine(jsonArray.Count);
  94    }
  95}";
  96            string expectedOutput =
  97@"False
  980
  990
 100b
 1011
 1020";
 103
 104            var verifier = CompileAndVerifyOnWin8Only(source,
 105                expectedOutput: expectedOutput,
 106                additionalRefs: WinRtRefs,
 107                emitOptions: EmitOptions.RefEmitBug);
 108
 109            verifier.VerifyIL("Class1.Main",
 110@"{
 111// Code size      174 (0xae)
 112  .maxstack  3
 113  .locals init (Windows.Data.Json.JsonArray V_0, //jsonArray
 114  Windows.Data.Json.JsonValue V_1, //a
 115  Windows.Data.Json.JsonValue V_2, //b
 116  System.Collections.Generic.IEnumerator<Windows.Data.Json.IJsonValue> V_3)
 117  IL_0000:  newobj     ""Windows.Data.Json.JsonArray..ctor()""
 118  IL_0005:  stloc.0
 119  IL_0006:  ldstr      ""a""
 120  IL_000b:  call       ""Windows.Data.Json.JsonValue Windows.Data.Json.JsonValue.CreateStringValue(string)""
 121  IL_0010:  stloc.1
 122  IL_0011:  ldloc.0
 123  IL_0012:  ldloc.1
 124  IL_0013:  callvirt   ""void System.Collections.Generic.ICollection<Windows.Data.Json.IJsonValue>.Add(Windows.Data.Json.IJsonValue)""
 125  IL_0018:  ldstr      ""b""
 126  IL_001d:  call       ""Windows.Data.Json.JsonValue Windows.Data.Json.JsonValue.CreateStringValue(string)""
 127  IL_0022:  stloc.2
 128  IL_0023:  ldloc.0
 129  IL_0024:  ldc.i4.0
 130  IL_0025:  ldloc.2
 131  IL_0026:  callvirt   ""void System.Collections.Generic.IList<Windows.Data.Json.IJsonValue>.Insert(int, Windows.Data.Json.IJsonValue)""
 132  IL_002b:  ldloc.0
 133  IL_002c:  ldloc.2
 134  IL_002d:  callvirt   ""bool System.Collections.Generic.ICollection<Windows.Data.Json.IJsonValue>.Remove(Windows.Data.Json.IJsonValue)""
 135  IL_0032:  pop
 136  IL_0033:  ldloc.0
 137  IL_0034:  ldloc.2
 138  IL_0035:  callvirt   ""bool System.Collections.Generic.ICollection<Windows.Data.Json.IJsonValue>.Contains(Windows.Data.Json.IJsonValue)""
 139  IL_003a:  call       ""void System.Console.WriteLine(bool)""
 140  IL_003f:  ldloc.0
 141  IL_0040:  ldloc.1
 142  IL_0041:  callvirt   ""int System.Collections.Generic.IList<Windows.Data.Json.IJsonValue>.IndexOf(Windows.Data.Json.IJsonValue)""
 143  IL_0046:  call       ""void System.Console.WriteLine(int)""
 144  IL_004b:  ldloc.0
 145  IL_004c:  ldc.i4.0
 146  IL_004d:  callvirt   ""void System.Collections.Generic.IList<Windows.Data.Json.IJsonValue>.RemoveAt(int)""
 147  IL_0052:  ldloc.0
 148  IL_0053:  callvirt   ""int System.Collections.Generic.ICollection<Windows.Data.Json.IJsonValue>.Count.get""
 149  IL_0058:  call       ""void System.Console.WriteLine(int)""
 150  IL_005d:  ldloc.0
 151  IL_005e:  ldloc.2
 152  IL_005f:  callvirt   ""void System.Collections.Generic.ICollection<Windows.Data.Json.IJsonValue>.Add(Windows.Data.Json.IJsonValue)""
 153  IL_0064:  ldloc.0
 154  IL_0065:  callvirt   ""System.Collections.Generic.IEnumerator<Windows.Data.Json.IJsonValue> System.Collections.Generic.IEnumerable<Windows.Data.Json.IJsonValue>.GetEnumerator()""
 155  IL_006a:  stloc.3
 156  .try
 157{
 158  IL_006b:  br.s       IL_007d
 159  IL_006d:  ldloc.3
 160  IL_006e:  callvirt   ""Windows.Data.Json.IJsonValue System.Collections.Generic.IEnumerator<Windows.Data.Json.IJsonValue>.Current.get""
 161  IL_0073:  callvirt   ""string Windows.Data.Json.IJsonValue.GetString()""
 162  IL_0078:  call       ""void System.Console.WriteLine(string)""
 163  IL_007d:  ldloc.3
 164  IL_007e:  callvirt   ""bool System.Collections.IEnumerator.MoveNext()""
 165  IL_0083:  brtrue.s   IL_006d
 166  IL_0085:  leave.s    IL_0091
 167}
 168  finally
 169{
 170  IL_0087:  ldloc.3
 171  IL_0088:  brfalse.s  IL_0090
 172  IL_008a:  ldloc.3
 173  IL_008b:  callvirt   ""void System.IDisposable.Dispose()""
 174  IL_0090:  endfinally
 175}
 176  IL_0091:  ldloc.0
 177  IL_0092:  callvirt   ""int System.Collections.Generic.ICollection<Windows.Data.Json.IJsonValue>.Count.get""
 178  IL_0097:  call       ""void System.Console.WriteLine(int)""
 179  IL_009c:  ldloc.0
 180  IL_009d:  callvirt   ""void System.Collections.Generic.ICollection<Windows.Data.Json.IJsonValue>.Clear()""
 181  IL_00a2:  ldloc.0
 182  IL_00a3:  callvirt   ""int System.Collections.Generic.ICollection<Windows.Data.Json.IJsonValue>.Count.get""
 183  IL_00a8:  call       ""void System.Console.WriteLine(int)""
 184  IL_00ad:  ret
 185}
 186");
 187        }
 188
 189        [Fact]
 190        public void IVectorViewProjectionTests()
 191        {
 192            var source =
 193@"using System;
 194using Windows.Foundation;
 195
 196public class Class1
 197{
 198    public static void Main(string[] args)
 199    {
 200        var results = new WwwFormUrlDecoder(""?param1=test"");
 201        Console.Out.WriteLine(results[0].Name + results[0].Value);
 202    }
 203}";
 204            var expectedOut = "param1test";
 205            var verifier = CompileAndVerifyOnWin8Only(
 206                source,
 207                expectedOutput: expectedOut,
 208                additionalRefs: WinRtRefs,
 209                emitOptions: EmitOptions.RefEmitBug);
 210
 211            verifier.VerifyIL("Class1.Main",
 212@"{
 213  // Code size       51 (0x33)
 214  .maxstack  4
 215  .locals init (Windows.Foundation.WwwFormUrlDecoder V_0) //results
 216  IL_0000:  ldstr      ""?param1=test""
 217  IL_0005:  newobj     ""Windows.Foundation.WwwFormUrlDecoder..ctor(string)""
 218  IL_000a:  stloc.0
 219  IL_000b:  call       ""System.IO.TextWriter System.Console.Out.get""
 220  IL_0010:  ldloc.0
 221  IL_0011:  ldc.i4.0
 222  IL_0012:  callvirt   ""Windows.Foundation.IWwwFormUrlDecoderEntry System.Collections.Generic.IReadOnlyList<Windows.Foundation.IWwwFormUrlDecoderEntry>.this[int].get""
 223  IL_0017:  callvirt   ""string Windows.Foundation.IWwwFormUrlDecoderEntry.Name.get""
 224  IL_001c:  ldloc.0
 225  IL_001d:  ldc.i4.0
 226  IL_001e:  callvirt   ""Windows.Foundation.IWwwFormUrlDecoderEntry System.Collections.Generic.IReadOnlyList<Windows.Foundation.IWwwFormUrlDecoderEntry>.this[int].get""
 227  IL_0023:  callvirt   ""string Windows.Foundation.IWwwFormUrlDecoderEntry.Value.get""
 228  IL_0028:  call       ""string string.Concat(string, string)""
 229  IL_002d:  callvirt   ""void System.IO.TextWriter.WriteLine(string)""
 230  IL_0032:  ret
 231}");
 232        }
 233
 234        [Fact]
 235        public void IMapProjectionTests()
 236        {
 237            var source =
 238@"using System;
 239using System.Collections.Generic;
 240using Windows.ApplicationModel.DataTransfer;
 241
 242public class Class1
 243{
 244    public static void Main(string[] args)
 245    {
 246        var dataPackage = new DataPackage();
 247        var dpps = dataPackage.Properties;
 248        dpps.Add(new KeyValuePair<string, object>(""testKey1"", ""testValue1""));
 249        Console.Out.WriteLine(dpps.ContainsKey(""testKey1""));
 250        Console.Out.WriteLine(dpps[""testKey1""]);
 251        dpps.Add(""testKey2"", ""testValue2"");
 252        object tv2;
 253        dpps.TryGetValue(""testKey2"", out tv2);
 254        Console.Out.WriteLine(tv2);
 255        dpps[""testKey2""] = ""testValue3"";
 256        dpps.Remove(""testKey1"");
 257        var valsEnumerator = dpps.Values.GetEnumerator();
 258        var keysEnumerator = dpps.Keys.GetEnumerator();
 259        while (keysEnumerator.MoveNext() && valsEnumerator.MoveNext())
 260        {
 261            Console.Out.WriteLine(keysEnumerator.Current + valsEnumerator.Current);
 262        }
 263    }
 264}";
 265
 266            var expectedOut =
 267@"True
 268testValue1
 269testValue2
 270testKey2testValue3
 271";
 272            var verifier = CompileAndVerifyOnWin8Only(
 273                source,
 274                expectedOutput: expectedOut,
 275                additionalRefs: WinRtRefs,
 276                emitOptions: EmitOptions.RefEmitBug);
 277
 278            verifier.VerifyIL("Class1.Main",
 279@"{
 280// Code size      213 (0xd5)
 281  .maxstack  3
 282  .locals init (Windows.ApplicationModel.DataTransfer.DataPackagePropertySet V_0, //dpps
 283  object V_1, //tv2
 284  System.Collections.Generic.IEnumerator<object> V_2, //valsEnumerator
 285  System.Collections.Generic.IEnumerator<string> V_3) //keysEnumerator
 286  IL_0000:  newobj     ""Windows.ApplicationModel.DataTransfer.DataPackage..ctor()""
 287  IL_0005:  callvirt   ""Windows.ApplicationModel.DataTransfer.DataPackagePropertySet Windows.ApplicationModel.DataTransfer.DataPackage.Properties.get""
 288  IL_000a:  stloc.0
 289  IL_000b:  ldloc.0
 290  IL_000c:  ldstr      ""testKey1""
 291  IL_0011:  ldstr      ""testValue1""
 292  IL_0016:  newobj     ""System.Collections.Generic.KeyValuePair<string, object>..ctor(string, object)""
 293  IL_001b:  callvirt   ""void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string, object>>.Add(System.Collections.Generic.KeyValuePair<string, object>)""
 294  IL_0020:  call       ""System.IO.TextWriter System.Console.Out.get""
 295  IL_0025:  ldloc.0
 296  IL_0026:  ldstr      ""testKey1""
 297  IL_002b:  callvirt   ""bool System.Collections.Generic.IDictionary<string, object>.ContainsKey(string)""
 298  IL_0030:  callvirt   ""void System.IO.TextWriter.WriteLine(bool)""
 299  IL_0035:  call       ""System.IO.TextWriter System.Console.Out.get""
 300  IL_003a:  ldloc.0
 301  IL_003b:  ldstr      ""testKey1""
 302  IL_0040:  callvirt   ""object System.Collections.Generic.IDictionary<string, object>.this[string].get""
 303  IL_0045:  callvirt   ""void System.IO.TextWriter.WriteLine(object)""
 304  IL_004a:  ldloc.0
 305  IL_004b:  ldstr      ""testKey2""
 306  IL_0050:  ldstr      ""testValue2""
 307  IL_0055:  callvirt   ""void System.Collections.Generic.IDictionary<string, object>.Add(string, object)""
 308  IL_005a:  ldloc.0
 309  IL_005b:  ldstr      ""testKey2""
 310  IL_0060:  ldloca.s   V_1
 311  IL_0062:  callvirt   ""bool System.Collections.Generic.IDictionary<string, object>.TryGetValue(string, out object)""
 312  IL_0067:  pop
 313  IL_0068:  call       ""System.IO.TextWriter System.Console.Out.get""
 314  IL_006d:  ldloc.1
 315  IL_006e:  callvirt   ""void System.IO.TextWriter.WriteLine(object)""
 316  IL_0073:  ldloc.0
 317  IL_0074:  ldstr      ""testKey2""
 318  IL_0079:  ldstr      ""testValue3""
 319  IL_007e:  callvirt   ""void System.Collections.Generic.IDictionary<string, object>.this[string].set""
 320  IL_0083:  ldloc.0
 321  IL_0084:  ldstr      ""testKey1""
 322  IL_0089:  callvirt   ""bool System.Collections.Generic.IDictionary<string, object>.Remove(string)""
 323  IL_008e:  pop
 324  IL_008f:  ldloc.0
 325  IL_0090:  callvirt   ""System.Collections.Generic.ICollection<object> System.Collections.Generic.IDictionary<string, object>.Values.get""
 326  IL_0095:  callvirt   ""System.Collections.Generic.IEnumerator<object> System.Collections.Generic.IEnumerable<object>.GetEnumerator()""
 327  IL_009a:  stloc.2
 328  IL_009b:  ldloc.0
 329  IL_009c:  callvirt   ""System.Collections.Generic.ICollection<string> System.Collections.Generic.IDictionary<string, object>.Keys.get""
 330  IL_00a1:  callvirt   ""System.Collections.Generic.IEnumerator<string> System.Collections.Generic.IEnumerable<string>.GetEnumerator()""
 331  IL_00a6:  stloc.3
 332  IL_00a7:  br.s       IL_00c4
 333  IL_00a9:  call       ""System.IO.TextWriter System.Console.Out.get""
 334  IL_00ae:  ldloc.3
 335  IL_00af:  callvirt   ""string System.Collections.Generic.IEnumerator<string>.Current.get""
 336  IL_00b4:  ldloc.2
 337  IL_00b5:  callvirt   ""object System.Collections.Generic.IEnumerator<object>.Current.get""
 338  IL_00ba:  call       ""string string.Concat(object, object)""
 339  IL_00bf:  callvirt   ""void System.IO.TextWriter.WriteLine(string)""
 340  IL_00c4:  ldloc.3
 341  IL_00c5:  callvirt   ""bool System.Collections.IEnumerator.MoveNext()""
 342  IL_00ca:  brfalse.s  IL_00d4
 343  IL_00cc:  ldloc.2
 344  IL_00cd:  callvirt   ""bool System.Collections.IEnumerator.MoveNext()""
 345  IL_00d2:  brtrue.s   IL_00a9
 346  IL_00d4:  ret
 347}");
 348        }
 349
 350        // TODO: There are no suitable winmd members to test the IMapView projections,
 351        // a custom winmd will have to be used after winmd references are implemented
 352
 353        [Fact]
 354        public void MultipleInterfaceMethodConflictTests()
 355        {
 356            var source =
 357@"using Windows.Data.Json;
 358using Windows.Foundation;
 359
 360public class Class1
 361{
 362    public static void Main(string[] args)
 363    {
 364        var en = new JsonArray().GetEnumerator();
 365        en = new WwwFormUrlDecoder(""?param1=test"").GetEnumerator();
 366    }
 367}";
 368            var comp = CreateCompilation(source, references: WinRtRefs);
 369            // JsonArray implements both IEnumerable and IList, which both have a GetEnumerator
 370            // method. We can't know which interface method to call, so we shouldn't emit a
 371            // GetEnumerator method at all.
 372            comp.VerifyDiagnostics(
 373                Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "GetEnumerator")
 374                .WithArguments("Windows.Data.Json.JsonArray", "GetEnumerator"),
 375                Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "GetEnumerator")
 376                .WithArguments("Windows.Foundation.WwwFormUrlDecoder", "GetEnumerator"));
 377
 378        }
 379
 380        [Fact]
 381        public void LegacyCollectionTest01()
 382        {
 383            var source =
 384@"using Windows.Languages.WinRTTest;
 385using System.Collections.Generic;
 386using System.Reflection;
 387using System.Linq.Expressions;
 388using System;
 389using System.Linq;
 390
 391class AllMembers
 392{
 393    private static int FailedCount = 0;
 394    private static bool ValidateMethod(TestMethodCalled actual, TestMethodCalled expected)
 395    {
 396        var temp = Console.ForegroundColor;
 397        if (actual != expected)
 398        {
 399            FailedCount++;
 400            Console.ForegroundColor = ConsoleColor.Red;
 401            Console.Write(""FAIL:  "");
 402        }
 403        else
 404        {
 405            Console.ForegroundColor = ConsoleColor.Green;
 406            Console.Write(""PASS:  "");
 407        }
 408
 409        Console.ForegroundColor = temp;
 410        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
 411        return actual == expected;
 412    }
 413
 414    private static bool ValidateValue(object actual, object expected)
 415    {
 416        var temp = Console.ForegroundColor;
 417        if (actual.ToString() != expected.ToString())
 418        {
 419            FailedCount++;
 420            Console.ForegroundColor = ConsoleColor.Red;
 421            Console.Write(""FAIL:  "");
 422        }
 423        else
 424        {
 425            Console.ForegroundColor = ConsoleColor.Green;
 426            Console.Write(""PASS:  "");
 427        }
 428
 429        Console.ForegroundColor = temp;
 430        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
 431        return actual.ToString() == expected.ToString();
 432    }
 433
 434    static void TestIIterableMembers()
 435    {
 436        Console.WriteLine(""===  IIterableFloat  ==="");
 437        var i = new IIterableFloat();
 438        i.ClearFlag();
 439
 440        IEnumerator<float> enumerator = ((IEnumerable<float>)i).GetEnumerator();
 441        ValidateMethod(i.GetFlagState(), TestMethodCalled.IIterable_First);
 442    }
 443
 444    static int Main()
 445    {
 446        TestIIterableMembers();
 447        
 448        Console.WriteLine(FailedCount);
 449        return FailedCount;
 450    }
 451}";
 452            var verifier = CompileAndVerify(source,
 453                additionalRefs: LegacyRefs,
 454                emitOptions: EmitOptions.RefEmitBug,
 455                verify: false);
 456            verifier.VerifyDiagnostics(
 457                // (3,1): info CS8019: Unnecessary using directive.
 458                // using System.Reflection;
 459                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Reflection;"),
 460                // (4,1): info CS8019: Unnecessary using directive.
 461                // using System.Linq.Expressions;
 462                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq.Expressions;"),
 463                // (6,1): info CS8019: Unnecessary using directive.
 464                // using System.Linq;
 465                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq;"));
 466            verifier.VerifyIL("AllMembers.TestIIterableMembers",
 467@"{
 468  // Code size       41 (0x29)
 469  .maxstack  2
 470  IL_0000:  ldstr      ""===  IIterableFloat  ===""
 471  IL_0005:  call       ""void System.Console.WriteLine(string)""
 472  IL_000a:  newobj     ""Windows.Languages.WinRTTest.IIterableFloat..ctor()""
 473  IL_000f:  dup
 474  IL_0010:  callvirt   ""void Windows.Languages.WinRTTest.IIterableFloat.ClearFlag()""
 475  IL_0015:  dup
 476  IL_0016:  callvirt   ""System.Collections.Generic.IEnumerator<float> System.Collections.Generic.IEnumerable<float>.GetEnumerator()""
 477  IL_001b:  pop
 478  IL_001c:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IIterableFloat.GetFlagState()""
 479  IL_0021:  ldc.i4.1
 480  IL_0022:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
 481  IL_0027:  pop
 482  IL_0028:  ret
 483}");
 484        }
 485
 486        [Fact]
 487        public void LegacyCollectionTest02()
 488        {
 489            var source =
 490@"using Windows.Languages.WinRTTest;
 491using System.Collections.Generic;
 492using System.Reflection;
 493using System.Linq.Expressions;
 494using System;
 495using System.Linq;
 496
 497class AllMembers
 498{
 499    private static int FailedCount = 0;
 500    private static bool ValidateMethod(TestMethodCalled actual, TestMethodCalled expected)
 501    {
 502        var temp = Console.ForegroundColor;
 503        if (actual != expected)
 504        {
 505            FailedCount++;
 506            Console.ForegroundColor = ConsoleColor.Red;
 507            Console.Write(""FAIL:  "");
 508        }
 509        else
 510        {
 511            Console.ForegroundColor = ConsoleColor.Green;
 512            Console.Write(""PASS:  "");
 513        }
 514
 515        Console.ForegroundColor = temp;
 516        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
 517        return actual == expected;
 518    }
 519
 520    private static bool ValidateValue(object actual, object expected)
 521    {
 522        var temp = Console.ForegroundColor;
 523        if (actual.ToString() != expected.ToString())
 524        {
 525            FailedCount++;
 526            Console.ForegroundColor = ConsoleColor.Red;
 527            Console.Write(""FAIL:  "");
 528        }
 529        else
 530        {
 531            Console.ForegroundColor = ConsoleColor.Green;
 532            Console.Write(""PASS:  "");
 533        }
 534
 535        Console.ForegroundColor = temp;
 536        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
 537        return actual.ToString() == expected.ToString();
 538    }
 539
 540    static void TestIVectorIntMembers()
 541    {
 542        Console.WriteLine(""===  IVectorInt  ==="");
 543        var v = new IVectorInt();
 544        //Add
 545        v.ClearFlag();
 546        v.Add(1);
 547        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Append);
 548        ValidateValue(v[0], 1);
 549        //Contains
 550        v.ClearFlag();
 551        bool b = v.Contains(1);
 552        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
 553        ValidateValue(b, true);
 554        //CopyTo
 555        v.ClearFlag();
 556        int[] arr = new int[10];
 557        v.CopyTo(arr, 0);
 558        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
 559        ValidateValue(arr[0], 1);
 560        ValidateValue(arr[1], 0); //there should be nothing there! :)
 561        //GetEnumerator
 562        v.ClearFlag();
 563        int count = v.Count;
 564        IEnumerator<int> enumerator = ((IEnumerable<int>)v).GetEnumerator();
 565        ValidateMethod(v.GetFlagState(), TestMethodCalled.IIterable_First);
 566        int index = 0;
 567        foreach (var e in v)
 568        {
 569            index = index + 1;
 570            ValidateValue(e, index);
 571        }
 572
 573        ValidateValue(index, 1); //there should only be 1 element there
 574        //IndexOf
 575        v.ClearFlag();
 576        var rez = v.IndexOf(1);
 577        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
 578        ValidateValue(rez, 0); // 1 is on the first line :)
 579        //Insert
 580        v.ClearFlag();
 581        v.Insert(1, 2);
 582        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_InsertAt);
 583        ValidateValue(v[1], 2);
 584        //IsReadOnly
 585        v.ClearFlag();
 586        bool isReadOnly = v.IsReadOnly;
 587        ValidateMethod(v.GetFlagState(), TestMethodCalled.NotSet);
 588        ValidateValue(isReadOnly, false);
 589        //Indexing
 590        v.ClearFlag();
 591        int val = v[0];
 592        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
 593        ValidateValue(val, 1);
 594        v.ClearFlag();
 595        val = v[1];
 596        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
 597        ValidateValue(val, 2);
 598        //Remove
 599        v.ClearFlag();
 600        v.Remove(1);
 601        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
 602        ValidateValue(v.Count, 1);
 603        //RemoveAt
 604        v.ClearFlag();
 605        v.RemoveAt(0);
 606        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
 607        ValidateValue(v.Count, 0);
 608        //Clear
 609        v.Add(1);
 610        v.Add(2);
 611        v.ClearFlag();
 612        v.Clear();
 613        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Clear);
 614        ValidateValue(v.Count, 0);
 615    }
 616
 617    static void TestIVectorStructMembers()
 618    {
 619        Console.WriteLine(""===  IVectorStruct  ==="");
 620        var v = new IVectorStruct();
 621        var ud = new UserDefinedStruct()
 622        {
 623            Id = 1
 624        }
 625
 626        ;
 627        //Add
 628        v.ClearFlag();
 629        v.Add(ud);
 630        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Append);
 631        ValidateValue(v[0].Id, 1);
 632        //Contains
 633        v.ClearFlag();
 634        bool b = v.Contains(ud);
 635        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
 636        ValidateValue(b, true);
 637        //CopyTo
 638        v.ClearFlag();
 639        UserDefinedStruct[] arr = new UserDefinedStruct[10];
 640        v.CopyTo(arr, 0);
 641        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
 642        ValidateValue(arr[0].Id, ud.Id);
 643        //GetEnumerator
 644        v.ClearFlag();
 645        int count = v.Count;
 646        IEnumerator<UserDefinedStruct> enumerator = ((IEnumerable<UserDefinedStruct>)v).GetEnumerator();
 647        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_get_Size);
 648        enumerator.MoveNext();
 649        ValidateValue((enumerator.Current).Id, 1);
 650        int index = 0;
 651        foreach (var e in v)
 652        {
 653            index = index + 1;
 654            ValidateValue(e.Id, index);
 655        }
 656
 657        ValidateValue(index, 1); //there should only be 1 element there
 658        //IndexOf
 659        v.ClearFlag();
 660        var rez = v.IndexOf(ud);
 661        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
 662        ValidateValue(rez, 0); // 1 is on the first line :)
 663        //Insert
 664        v.ClearFlag();
 665        v.Insert(1, new UserDefinedStruct()
 666        {
 667            Id = 4
 668        }
 669
 670        );
 671        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_InsertAt);
 672        ValidateValue(v[1].Id, 4);
 673        //IsReadOnly
 674        v.ClearFlag();
 675        bool isReadOnly = v.IsReadOnly;
 676        ValidateMethod(v.GetFlagState(), TestMethodCalled.NotSet);
 677        ValidateValue(isReadOnly, false);
 678        //Indexing
 679        v.ClearFlag();
 680        var val = v[0];
 681        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
 682        ValidateValue(val.Id, ud.Id);
 683        v.ClearFlag();
 684        val = v[1];
 685        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
 686        ValidateValue(val.Id, 4);
 687        //Remove
 688        v.ClearFlag();
 689        v.Remove(ud);
 690        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
 691        ValidateValue(v.Count, 1);
 692        //RemoveAt
 693        v.ClearFlag();
 694        v.RemoveAt(0);
 695        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
 696        ValidateValue(v.Count, 0);
 697        //Clear
 698        v.Add(ud);
 699        v.Add(new UserDefinedStruct()
 700        {
 701            Id = 4
 702        }
 703
 704        );
 705        v.ClearFlag();
 706        v.Clear();
 707        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Clear);
 708        ValidateValue(v.Count, 0);
 709    }
 710
 711    static void TestIVectorUintStructMembers()
 712    {
 713        Console.WriteLine(""===  IVectorUintStruct  ==="");
 714        var v = new IVectorUintStruct();
 715        //Add
 716        v.ClearFlag();
 717        v.Add(7);
 718        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Append);
 719        ValidateValue((v as IList<uint>)[0], 7);
 720        //Contains
 721        v.ClearFlag();
 722        bool b = v.Contains(7);
 723        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
 724        ValidateValue(b, true);
 725        //IndexOf
 726        v.ClearFlag();
 727        var rez = ((IList<uint>)v).IndexOf(7);
 728        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
 729        ValidateValue(rez, 0);
 730        //Insert
 731        v.ClearFlag();
 732        v.Insert(1, 5);
 733        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_InsertAt);
 734        ValidateValue((v as IList<uint>)[1], 5);
 735        //IsReadOnly
 736        v.ClearFlag();
 737        bool isReadOnly = ((IList<uint>)v).IsReadOnly;
 738        ValidateMethod(v.GetFlagState(), TestMethodCalled.NotSet);
 739        ValidateValue(isReadOnly, false);
 740        //Indexing
 741        v.ClearFlag();
 742        uint val = ((uint)(v as IList<uint>)[0]);
 743        ValidateValue(val, 7);
 744        v.ClearFlag();
 745        val = ((IList<uint>)v)[1];
 746        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
 747        ValidateValue(val, 5);
 748        //Remove 
 749        v.ClearFlag();
 750        v.Remove(5);
 751        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
 752        ValidateValue(((IList<uint>)v).Count, 1);
 753        //RemoveAt
 754        try
 755        {
 756            v.ClearFlag();
 757            ((IList<uint>)v).RemoveAt(0);
 758            ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
 759            ValidateValue(((IList<uint>)v).Count, 0);
 760        }
 761        catch (Exception exce)
 762        {
 763            Console.WriteLine(""RemoveAt"");
 764            Console.WriteLine(exce.Message);
 765        }
 766
 767        //Clear
 768        v.Add(1);
 769        v.Add(2);
 770        v.ClearFlag();
 771        ((IList<uint>)v).Clear();
 772        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Clear);
 773        ValidateValue(((IList<uint>)v).Count, 0);
 774        var ud = new UserDefinedStruct()
 775        {
 776            Id = 1
 777        }
 778
 779        ;
 780        //Add
 781        v.ClearFlag();
 782        v.Add(ud);
 783        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Append);
 784        ValidateValue(((IList<UserDefinedStruct>)v)[0].Id, 1);
 785        //Contains
 786        v.ClearFlag();
 787        b = v.Contains(ud);
 788        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
 789        ValidateValue(b, true);
 790        //'CopyTo
 791        //v.ClearFlag()
 792        //Dim arr As UserDefinedStruct()
 793        //ReDim arr(10)
 794        //v.CopyTo(arr, 0)
 795        //ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt)
 796        //ValidateValue(arr[0].Id, ud.Id)
 797        //GetEnumerator
 798        v.ClearFlag();
 799        int count = ((IList<UserDefinedStruct>)v).Count;
 800        IEnumerator<UserDefinedStruct> enumerator = ((IList<UserDefinedStruct>)v).GetEnumerator();
 801        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetMany);
 802        enumerator.MoveNext();
 803        ValidateValue((enumerator.Current).Id, 1);
 804        //IndexOf
 805        v.ClearFlag();
 806        rez = v.IndexOf(ud);
 807        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
 808        ValidateValue(rez, 0); // 1 is on the first line :)
 809        //Insert
 810        v.ClearFlag();
 811        v.Insert(1, new UserDefinedStruct()
 812        {
 813            Id = 4
 814        }
 815
 816        );
 817        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_InsertAt);
 818        ValidateValue(((IList<UserDefinedStruct>)v)[1].Id, 4);
 819        //IsReadOnly
 820        v.ClearFlag();
 821        isReadOnly = ((IList<UserDefinedStruct>)v).IsReadOnly;
 822        ValidateMethod(v.GetFlagState(), TestMethodCalled.NotSet);
 823        ValidateValue(isReadOnly, false);
 824        //Indexing
 825        v.ClearFlag();
 826        var val2 = ((IList<UserDefinedStruct>)v)[0];
 827        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
 828        ValidateValue(val2.Id, ud.Id);
 829        v.ClearFlag();
 830        val2 = ((IList<UserDefinedStruct>)v)[1];
 831        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
 832        ValidateValue(val2.Id, 4);
 833        //Remove
 834        v.ClearFlag();
 835        v.Remove(ud);
 836        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
 837        ValidateValue(((IList<UserDefinedStruct>)v).Count, 1);
 838        //RemoveAt
 839        v.ClearFlag();
 840        ((IList<UserDefinedStruct>)v).RemoveAt(0);
 841        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
 842        ValidateValue(((IList<UserDefinedStruct>)v).Count, 0);
 843        //Clear
 844        v.Add(ud);
 845        v.Add(new UserDefinedStruct()
 846        {
 847            Id = 4
 848        }
 849
 850        );
 851        v.ClearFlag();
 852        ((IList<UserDefinedStruct>)v).Clear();
 853        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Clear);
 854        ValidateValue(((IList<UserDefinedStruct>)v).Count, 0);
 855    }
 856
 857    static void TestIVectorUintFloatMembers()
 858    {
 859        Console.WriteLine(""===  IVectorUintIVectorFloat  ==="");
 860        var v = new IVectorUintIVectorFloat();
 861        //Add
 862        v.ClearFlag();
 863        v.Add(7);
 864        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Append);
 865        ValidateValue(((IList<uint>)v).Count, 1);
 866        try
 867        {
 868            ValidateValue(((IList<uint>)v)[0], 7);
 869        }
 870        catch (ArgumentException exc)
 871        {
 872            Console.WriteLine(exc.Message);
 873        }
 874
 875        //Contains
 876        v.ClearFlag();
 877        bool b = v.Contains(7);
 878        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
 879        ValidateValue(b, true);
 880        //IndexOf
 881        v.ClearFlag();
 882        var rez = ((IList<uint>)v).IndexOf(7);
 883        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
 884        ValidateValue(rez, 0);
 885        //Insertv.ClearFlag()
 886        v.Insert(1, 5);
 887        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_InsertAt);
 888        try
 889        {
 890            ValidateValue(((IList<uint>)v)[1], 5);
 891        }
 892        catch (ArgumentException exc)
 893        {
 894            Console.WriteLine(exc.Message);
 895        }
 896
 897        //IsReadOnly
 898        v.ClearFlag();
 899        bool isReadOnly = ((IList<uint>)v).IsReadOnly;
 900        ValidateMethod(v.GetFlagState(), TestMethodCalled.NotSet);
 901        ValidateValue(isReadOnly, false);
 902        //Indexing
 903        try
 904        {
 905            v.ClearFlag();
 906            var val = (v as IList<uint>)[0];
 907            ValidateValue(val, 7);
 908            v.ClearFlag();
 909            val = ((IList<uint>)v)[1];
 910            ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
 911            ValidateValue(val, 5);
 912        }
 913        catch (Exception exce)
 914        {
 915            Console.WriteLine(""Indexing"");
 916            Console.WriteLine(exce.Message);
 917        }
 918
 919        //Remove 
 920        v.ClearFlag();
 921        v.Remove(5);
 922        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
 923        ValidateValue(((IList<uint>)v).Count, 1);
 924        //RemoveAt
 925        try
 926        {
 927            v.ClearFlag();
 928            ((IList<uint>)v).RemoveAt(0);
 929            ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
 930            ValidateValue(((IList<uint>)v).Count, 0);
 931        }
 932        catch (Exception exce)
 933        {
 934            Console.WriteLine(""RemoveAt"");
 935            Console.WriteLine(exce.Message);
 936        }
 937
 938        //Clear
 939        v.Add(1);
 940        v.Add(2);
 941        v.ClearFlag();
 942        ((IList<uint>)v).Clear();
 943        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Clear);
 944        ValidateValue(((IList<uint>)v).Count, 0);
 945        //single
 946        //Add
 947        v.ClearFlag();
 948        float one = 1;
 949        v.Add(one);
 950        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Append);
 951        ValidateValue(((IList<float>)v)[0], one);
 952        //Contains
 953        v.ClearFlag();
 954        b = v.Contains(one);
 955        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
 956        ValidateValue(b, true);
 957        //'CopyTo
 958        //v.ClearFlag()
 959        //Dim arr As single()
 960        //ReDim arr(10)
 961        //v.CopyTo(arr, 0)
 962        //ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt)
 963        //ValidateValue(arr[0].Id, ud.Id)
 964        //IndexOf
 965        v.ClearFlag();
 966        rez = v.IndexOf(one);
 967        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
 968        ValidateValue(rez, 0); // 1 is on the first line :)
 969        //Insert
 970        v.ClearFlag();
 971        v.Insert(1, (float)4);
 972        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_InsertAt);
 973        ValidateValue(((IList<float>)v)[1], 4);
 974        //IsReadOnly
 975        v.ClearFlag();
 976        isReadOnly = ((IList<float>)v).IsReadOnly;
 977        ValidateMethod(v.GetFlagState(), TestMethodCalled.NotSet);
 978        ValidateValue(isReadOnly, false);
 979        //Indexing
 980        v.ClearFlag();
 981        var val2 = ((IList<float>)v)[0];
 982        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
 983        ValidateValue(val2, one);
 984        v.ClearFlag();
 985        val2 = ((IList<float>)v)[1];
 986        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
 987        ValidateValue(val2, 4);
 988        //Remove
 989        v.ClearFlag();
 990        v.Remove(one);
 991        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
 992        ValidateValue(((IList<float>)v).Count, 1);
 993        //RemoveAt
 994        v.ClearFlag();
 995        ((IList<float>)v).RemoveAt(0);
 996        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
 997        ValidateValue(((IList<float>)v).Count, 0);
 998        //Clear
 999        v.Add(one);
1000        v.ClearFlag();
1001        ((IList<float>)v).Clear();
1002        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Clear);
1003        ValidateValue(((IList<float>)v).Count, 0);
1004    }
1005
1006    static void TestIVectorIntIMapIntIntMembers()
1007    {
1008        Console.WriteLine(""===  IVectorIntIMapIntInt  ==="");
1009        var v = new IVectorIntIMapIntInt();
1010        //Add
1011        v.ClearFlag();
1012        v.Add(1);
1013        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Append);
1014        ValidateValue((v as IList<int>)[0], 1);
1015        //Contains
1016        v.ClearFlag();
1017        bool b = v.Contains(1);
1018        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
1019        ValidateValue(b, true);
1020        //CopyTo
1021        v.ClearFlag();
1022        int[] arr = new int[10];
1023        v.CopyTo(arr, 0);
1024        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
1025        ValidateValue(arr[0], 1);
1026        ValidateValue(arr[1], 0); //there should be nothing there! :)
1027        //'GetEnumerator
1028        //v.ClearFlag()
1029        //Dim count As Integer = v.Count
1030        //Dim enumerator As IEnumerator(Of Integer) = v.GetEnumerator()
1031        //ValidateMethod(v.GetFlagState(), TestMethodCalled.IIterable_First)
1032        //Dim index As Integer = 0
1033        //For Each e In v
1034        //    index = index + 1
1035        //    ValidateValue(e, index)
1036        //Next
1037        //ValidateValue(index, 1) 'there should only be 1 element there
1038        //IndexOf
1039        v.ClearFlag();
1040        var rez = v.IndexOf(1);
1041        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
1042        ValidateValue(rez, 0); // 1 is on the first line :)
1043        //Insert
1044        v.ClearFlag();
1045        v.Insert(1, 2);
1046        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_InsertAt);
1047        ValidateValue((v as IList<int>)[1], 2);
1048        //IsReadOnly
1049        v.ClearFlag();
1050        bool isReadOnly = ((IList<int>)v).IsReadOnly;
1051        ValidateMethod(v.GetFlagState(), TestMethodCalled.NotSet);
1052        ValidateValue(isReadOnly, false);
1053        //Indexing
1054        v.ClearFlag();
1055        int val = ((int)(v as IList<int>)[0]);
1056        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
1057        ValidateValue(val, 1);
1058        v.ClearFlag();
1059        val = ((IList<int>)v)[1];
1060        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
1061        ValidateValue(val, 2);
1062        //Remove
1063        v.ClearFlag();
1064        ((IList<int>)v).Remove(1);
1065        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
1066        ValidateValue(((IList<int>)v).Count, 1);
1067        //RemoveAt
1068        v.ClearFlag();
1069        v.RemoveAt(0);
1070        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
1071        ValidateValue(((IList<int>)v).Count, 0);
1072        //Clear
1073        v.Add(1);
1074        v.Add(2);
1075        v.ClearFlag();
1076        ((IList<int>)v).Clear();
1077        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Clear);
1078        ValidateValue(((IList<int>)v).Count, 0);
1079        var m = v;
1080        //Add
1081        m.ClearFlag();
1082        m.Add(1, 2);
1083        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Insert);
1084        ValidateValue(((IDictionary<int, int>)m).Count, 1);
1085        //ContainsKey
1086        m.ClearFlag();
1087        bool key = m.ContainsKey(1);
1088        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_HasKey);
1089        //Lookup
1090        m.ClearFlag();
1091        int val2 = ((int)(v as IDictionary<int, int>)[1]);
1092        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Lookup);
1093        ValidateValue(val2, 2);
1094        //Keys
1095        m.ClearFlag();
1096        var keys = m.Keys;
1097        ValidateMethod(m.GetFlagState(), TestMethodCalled.NotSet);
1098        //Values
1099        m.ClearFlag();
1100        var values = m.Values;
1101        ValidateMethod(m.GetFlagState(), TestMethodCalled.NotSet);
1102        //Lookup
1103        m.ClearFlag();
1104        int outVal;
1105        bool success = ((IDictionary<int, int>)m).TryGetValue(1, out outVal);
1106        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Lookup);
1107        ValidateValue(success, true);
1108        ValidateValue(outVal, 2);
1109        //Add
1110        m.ClearFlag();
1111        m.Add(new KeyValuePair<int, int>(3, 4));
1112        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Insert);
1113        ValidateValue(((IDictionary<int, int>)m).Count, 2);
1114        //Contains
1115        m.ClearFlag();
1116        bool contains = m.Contains(new KeyValuePair<int, int>(3, 4));
1117        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Lookup);
1118        ValidateValue(contains, true);
1119        //non-existant pair
1120        m.ClearFlag();
1121        contains = m.Contains(new KeyValuePair<int, int>(8, 9));
1122        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_HasKey);
1123        ValidateValue(contains, false);
1124        //Remove
1125        m.ClearFlag();
1126        bool remove = ((IDictionary<int, int>)m).Remove(1);
1127        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Remove);
1128        ValidateValue(((IDictionary<int, int>)m).Count, 1);
1129        ValidateValue(remove, true);
1130        //CopyTo
1131        //m.ClearFlag()
1132        //Dim arr As KeyValuePair(Of Integer, Integer)()
1133        //ReDim arr(10)
1134        //m.CopyTo(arr, 1)
1135        //ValidateMethod(m.GetFlagState(), TestMethodCalled.IVector_GetAt)
1136        //ValidateValue(arr[0].Value, 2)
1137        //Count
1138        m.ClearFlag();
1139        int count = ((IDictionary<int, int>)m).Count;
1140        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_get_Size);
1141        ValidateValue(count, 1);
1142        //isReadOnly
1143        m.ClearFlag();
1144        isReadOnly = ((IDictionary<int, int>)m).IsReadOnly;
1145        ValidateMethod(m.GetFlagState(), TestMethodCalled.NotSet);
1146        ValidateValue(isReadOnly, false);
1147        //Remove
1148        m.ClearFlag();
1149        var rez2 = m.Remove(new KeyValuePair<int, int>(3, 4));
1150        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Remove);
1151        ValidateValue(rez2, true);
1152        m.ClearFlag();
1153        rez2 = m.Remove(new KeyValuePair<int, int>(2, 3));
1154        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_HasKey);
1155        ValidateValue(rez2, false);
1156        m.Add(1, 2);
1157        m.Add(2, 3);
1158        m.ClearFlag();
1159        ((IDictionary<int, int>)m).Clear();
1160        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Clear);
1161        ValidateValue(((IDictionary<int, int>)m).Count, 0);
1162    }
1163
1164    static void TestIVectorExplicitAddMembers()
1165    {
1166        IVectorExplicitAdd v = new IVectorExplicitAdd();
1167        //Calling the user defined Add method
1168        v.ClearFlag();
1169        ((IMemberAdd)v).Add(1);
1170        ValidateMethod(v.GetFlagState(), TestMethodCalled.UserDef_Add);
1171        v.ClearFlag();
1172        ((IMemberAdd)v).Add(1);
1173        ValidateMethod(v.GetFlagState(), TestMethodCalled.UserDef_Add);
1174        //Calling the Interface Add's method
1175        v.ClearFlag();
1176        ((IList<int>)v).Add(1);
1177        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Append);
1178        ValidateValue(v[0], 1);
1179    }
1180
1181    static void TestIVectorViewMembers()
1182    {
1183        var v = new IVectorViewInt();
1184        v.ClearFlag();
1185        int count = v.Count;
1186        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVectorView_get_Size);
1187    }
1188
1189    static void TestIVectorUIntIVectorViewIntMembers()
1190    {
1191        Console.WriteLine(""===  IVectorUintIVectorViewInt  ==="");
1192        var v = new IVectorUintIVectorViewInt();
1193        //Add
1194        v.ClearFlag();
1195        v.Add(1);
1196        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Append);
1197        ValidateValue((v as IList<uint>)[0], 1);
1198        //Contains
1199        v.ClearFlag();
1200        bool b = v.Contains(1);
1201        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
1202        ValidateValue(b, true);
1203        //CopyTo
1204        v.ClearFlag();
1205        uint[] arr = new uint[10];
1206        v.CopyTo(arr, 0);
1207        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
1208        ValidateValue(arr[0], 1);
1209        ValidateValue(arr[1], 0); //there should be nothing there! :)
1210        //GetEnumerator
1211        v.ClearFlag();
1212        uint count = ((uint)(v as IList<uint>).Count);
1213        IEnumerator<uint> enumerator = ((IEnumerable<uint>)v).GetEnumerator();
1214        ValidateMethod(v.GetFlagState(), TestMethodCalled.IIterable_First);
1215        uint index = 0;
1216        foreach (var e in v)
1217        {
1218            index = ((uint)index + 1);
1219            ValidateValue(e, index);
1220        }
1221
1222        ValidateValue(index, 1); //there should only be 1 element there
1223        //IndexOf
1224        v.ClearFlag();
1225        var rez = v.IndexOf(1);
1226        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
1227        ValidateValue(rez, 0); // 1 is on the first line :)
1228        //Insert
1229        v.ClearFlag();
1230        v.Insert(1, 2);
1231        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_InsertAt);
1232        ValidateValue((v as IList<uint>)[1], 2);
1233        //IsReadOnly
1234        v.ClearFlag();
1235        bool isReadOnly = v.IsReadOnly;
1236        ValidateMethod(v.GetFlagState(), TestMethodCalled.NotSet);
1237        ValidateValue(isReadOnly, false);
1238        //Indexing
1239        v.ClearFlag();
1240        uint val = (v as IList<uint>)[0];
1241        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
1242        ValidateValue(val, 1);
1243        v.ClearFlag();
1244        val = (((IList<uint>)v))[1];
1245        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
1246        ValidateValue(val, 2);
1247        //Remove
1248        v.ClearFlag();
1249        v.Remove(1);
1250        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
1251        ValidateValue((v as IList<uint>).Count, 1);
1252        //RemoveAt
1253        v.ClearFlag();
1254        v.RemoveAt(0);
1255        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
1256        ValidateValue((v as IList<uint>).Count, 0);
1257        //Clear
1258        v.Add(1);
1259        v.Add(2);
1260        v.ClearFlag();
1261        v.Clear();
1262        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Clear);
1263        ValidateValue((v as IList<uint>).Count, 0);
1264        // IVectorView members
1265        v.Add(1);
1266        v.Add(2);
1267        v.ClearFlag();
1268        ValidateValue(((IReadOnlyList<uint>)v).Count, 2);
1269        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_get_Size);
1270        v.ClearFlag();
1271        ValidateValue(((IReadOnlyList<uint>)v)[0], 1);
1272        ValidateValue(((IReadOnlyList<uint>)v)[1], 2);
1273        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVectorView_GetAt);
1274    }
1275
1276    static void TestIVectorIntIVectorViewUintMembers()
1277    {
1278        Console.WriteLine(""===  IVectorIntIVectorViewUint  ==="");
1279        var v = new IVectorIntIVectorViewUint();
1280        //Add
1281        v.ClearFlag();
1282        v.Add(1);
1283        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Append);
1284        ValidateValue((v as IList<int>)[0], 1);
1285        //Contains
1286        v.ClearFlag();
1287        bool b = v.Contains(1);
1288        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
1289        ValidateValue(b, true);
1290        //CopyTo
1291        v.ClearFlag();
1292        int[] arr = new int[10];
1293        v.CopyTo(arr, 0);
1294        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
1295        ValidateValue(arr[0], 1);
1296        ValidateValue(arr[1], 0); //there should be nothing there! :)
1297        //GetEnumerator
1298        v.ClearFlag();
1299        uint count = ((uint)(((IList<int>)v)).Count);
1300        IEnumerator<int> enumerator = (((IList<int>)v)).GetEnumerator();
1301        ValidateMethod(v.GetFlagState(), TestMethodCalled.IIterable_First);
1302        uint index = 0;
1303        foreach (var e in (((IList<int>)v)))
1304        {
1305            index = ((uint)index + 1);
1306            ValidateValue(e, index);
1307        }
1308
1309        ValidateValue(index, 1); //there should only be 1 element there
1310        //IndexOf
1311        v.ClearFlag();
1312        var rez = v.IndexOf(1);
1313        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
1314        ValidateValue(rez, 0); // 1 is on the first line :)
1315        //Insert
1316        v.ClearFlag();
1317        v.Insert(1, 2);
1318        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_InsertAt);
1319        ValidateValue((v as IList<int>)[1], 2);
1320        //IsReadOnly
1321        v.ClearFlag();
1322        bool isReadOnly = v.IsReadOnly;
1323        ValidateMethod(v.GetFlagState(), TestMethodCalled.NotSet);
1324        ValidateValue(isReadOnly, false);
1325        //Indexing
1326        v.ClearFlag();
1327        uint val = ((uint)(v as IList<int>)[0]);
1328        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
1329        ValidateValue(val, 1);
1330        v.ClearFlag();
1331        val = ((uint)(((IList<int>)v))[1]);
1332        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
1333        ValidateValue(val, 2);
1334        //Remove
1335        v.ClearFlag();
1336        v.Remove(1);
1337        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
1338        ValidateValue((((IList<int>)v)).Count, 1);
1339        //RemoveAt
1340        v.ClearFlag();
1341        v.RemoveAt(0);
1342        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
1343        ValidateValue((((IList<int>)v)).Count, 0);
1344        //Clear
1345        v.Add(1);
1346        v.Add(2);
1347        v.ClearFlag();
1348        v.Clear();
1349        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Clear);
1350        ValidateValue((((IList<int>)v)).Count, 0);
1351        // IVectorView members
1352        v.Add(1);
1353        v.Add(2);
1354        v.ClearFlag();
1355        ValidateValue(((IReadOnlyList<uint>)v)[0], 0);
1356        ValidateValue(((IReadOnlyList<uint>)v)[1], 0);
1357        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
1358    }
1359
1360    static void TestIVectorStructIVectorViewStructMembers()
1361    {
1362        Console.WriteLine(""===  IVectorStructIVectorViewStruct  ==="");
1363        var v = new IVectorStructIVectorViewStruct();
1364        var ud = new UserDefinedStruct()
1365        {
1366            Id = 1
1367        }
1368
1369        ;
1370        //Add
1371        v.ClearFlag();
1372        v.Add(ud);
1373        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Append);
1374        ValidateValue((v as IList<UserDefinedStruct>)[0].Id, 1);
1375        //Contains
1376        v.ClearFlag();
1377        bool b = v.Contains(ud);
1378        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
1379        ValidateValue(b, true);
1380        //CopyTo
1381        v.ClearFlag();
1382        UserDefinedStruct[] arr = new UserDefinedStruct[10];
1383        v.CopyTo(arr, 0);
1384        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
1385        ValidateValue(arr[0].Id, ud.Id);
1386        //GetEnumerator
1387        v.ClearFlag();
1388        int count = (v as IList<UserDefinedStruct>).Count;
1389        IEnumerator<UserDefinedStruct> enumerator = ((IEnumerable<UserDefinedStruct>)v).GetEnumerator();
1390        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_get_Size);
1391        enumerator.MoveNext();
1392        ValidateValue((enumerator.Current).Id, 1);
1393        int index = 0;
1394        foreach (var e in v)
1395        {
1396            index = index + 1;
1397            ValidateValue(e.Id, index);
1398        }
1399
1400        ValidateValue(index, 1); //there should only be 1 element there
1401        //IndexOf
1402        v.ClearFlag();
1403        var rez = v.IndexOf(ud);
1404        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
1405        ValidateValue(rez, 0); // 1 is on the first line :)
1406        //Insert
1407        v.ClearFlag();
1408        v.Insert(1, new UserDefinedStruct()
1409        {
1410            Id = 4
1411        }
1412
1413        );
1414        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_InsertAt);
1415        ValidateValue((v as IList<UserDefinedStruct>)[1].Id, 4);
1416        //IsReadOnly
1417        v.ClearFlag();
1418        bool isReadOnly = v.IsReadOnly;
1419        ValidateMethod(v.GetFlagState(), TestMethodCalled.NotSet);
1420        ValidateValue(isReadOnly, false);
1421        //Indexing
1422        v.ClearFlag();
1423        var val = (v as IList<UserDefinedStruct>)[0];
1424        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
1425        ValidateValue(val.Id, ud.Id);
1426        v.ClearFlag();
1427        val = ((IList<UserDefinedStruct>)v)[1];
1428        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
1429        ValidateValue(val.Id, 4);
1430        //Remove
1431        v.ClearFlag();
1432        v.Remove(ud);
1433        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
1434        ValidateValue((v as IList<UserDefinedStruct>).Count, 1);
1435        //RemoveAt
1436        v.ClearFlag();
1437        v.RemoveAt(0);
1438        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
1439        ValidateValue((v as IList<UserDefinedStruct>).Count, 0);
1440        //Clear
1441        v.Add(ud);
1442        v.Add(new UserDefinedStruct()
1443        {
1444            Id = 4
1445        }
1446
1447        );
1448        v.ClearFlag();
1449        v.Clear();
1450        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Clear);
1451        ValidateValue((v as IList<UserDefinedStruct>).Count, 0);
1452        // IVectorView members
1453        v.Add(ud);
1454        v.Add(new UserDefinedStruct()
1455        {
1456            Id = 4
1457        }
1458
1459        );
1460        v.ClearFlag();
1461        ValidateValue(((IReadOnlyList<UserDefinedStruct>)v)[0].Id, ud.Id);
1462        ValidateValue(((IReadOnlyList<UserDefinedStruct>)v)[1].Id, 4);
1463        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
1464    }
1465
1466    static int Main()
1467    {
1468        TestIVectorIntMembers();
1469        TestIVectorStructMembers();
1470        TestIVectorUintStructMembers();
1471        TestIVectorUintFloatMembers();
1472        TestIVectorIntIMapIntIntMembers();
1473        TestIVectorExplicitAddMembers();
1474        TestIVectorViewMembers();
1475        TestIVectorUIntIVectorViewIntMembers();
1476        TestIVectorIntIVectorViewUintMembers();
1477        TestIVectorStructIVectorViewStructMembers();
1478
1479        Console.WriteLine(FailedCount);
1480        return FailedCount;
1481    }
1482}";
1483            var comp = CreateCompilationWithMscorlibAndSystemCore(source, references: LegacyRefs);
1484            comp.VerifyDiagnostics(
1485                // (3,1): info CS8019: Unnecessary using directive.
1486                // using System.Reflection;
1487                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Reflection;"),
1488                // (4,1): info CS8019: Unnecessary using directive.
1489                // using System.Linq.Expressions;
1490                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq.Expressions;"),
1491                // (6,1): info CS8019: Unnecessary using directive.
1492                // using System.Linq;
1493                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq;"));
1494        }
1495
1496        [Fact]
1497        public void LegacyCollectionTest03()
1498        {
1499            var source =
1500@"using Windows.Languages.WinRTTest;
1501using System.Collections.Generic;
1502using System.Reflection;
1503using System.Linq.Expressions;
1504using System;
1505using System.Linq;
1506
1507class AllMembers
1508{
1509    private static int FailedCount = 0;
1510    private static bool ValidateMethod(TestMethodCalled actual, TestMethodCalled expected)
1511    {
1512        var temp = Console.ForegroundColor;
1513        if (actual != expected)
1514        {
1515            FailedCount++;
1516            Console.ForegroundColor = ConsoleColor.Red;
1517            Console.Write(""FAIL:  "");
1518        }
1519        else
1520        {
1521            Console.ForegroundColor = ConsoleColor.Green;
1522            Console.Write(""PASS:  "");
1523        }
1524
1525        Console.ForegroundColor = temp;
1526        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
1527        return actual == expected;
1528    }
1529
1530    private static bool ValidateValue(object actual, object expected)
1531    {
1532        var temp = Console.ForegroundColor;
1533        if (actual.ToString() != expected.ToString())
1534        {
1535            FailedCount++;
1536            Console.ForegroundColor = ConsoleColor.Red;
1537            Console.Write(""FAIL:  "");
1538        }
1539        else
1540        {
1541            Console.ForegroundColor = ConsoleColor.Green;
1542            Console.Write(""PASS:  "");
1543        }
1544
1545        Console.ForegroundColor = temp;
1546        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
1547        return actual.ToString() == expected.ToString();
1548    }
1549
1550    static void TestIMapIntIntMembers()
1551    {
1552        Console.WriteLine(""===  IMapIntInt  ==="");
1553        var m = new IMapIntInt();
1554        //Add
1555        m.ClearFlag();
1556        m.Add(1, 2);
1557        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Insert);
1558        ValidateValue(m.Count, 1);
1559        //ContainsKey
1560        m.ClearFlag();
1561        bool key = m.ContainsKey(1);
1562        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_HasKey);
1563        //Lookup
1564        m.ClearFlag();
1565        int val = m[1];
1566        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Lookup);
1567        ValidateValue(val, 2);
1568        //Keys
1569        m.ClearFlag();
1570        var keys = m.Keys;
1571        ValidateMethod(m.GetFlagState(), TestMethodCalled.NotSet);
1572        //Values
1573        m.ClearFlag();
1574        var values = m.Values;
1575        ValidateMethod(m.GetFlagState(), TestMethodCalled.NotSet);
1576        //Lookup
1577        m.ClearFlag();
1578        int outVal;
1579        bool success = ((IDictionary<int, int>)m).TryGetValue(1, out outVal);
1580        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Lookup);
1581        ValidateValue(outVal, 2);
1582        ValidateValue(success, true);
1583        //Add
1584        m.ClearFlag();
1585        m.Add(new KeyValuePair<int, int>(3, 4));
1586        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Insert);
1587        ValidateValue(m.Count, 2);
1588        //Contains
1589        m.ClearFlag();
1590        bool contains = m.Contains(new KeyValuePair<int, int>(3, 4));
1591        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Lookup);
1592        ValidateValue(contains, true);
1593        //non-existant pair
1594        m.ClearFlag();
1595        contains = m.Contains(new KeyValuePair<int, int>(8, 9));
1596        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_HasKey);
1597        ValidateValue(contains, false);
1598        //Remove
1599        m.ClearFlag();
1600        bool remove = m.Remove(1);
1601        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Remove);
1602        ValidateValue(m.Count, 1);
1603        ValidateValue(remove, true);
1604        //Count
1605        m.ClearFlag();
1606        int count = m.Count;
1607        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_get_Size);
1608        ValidateValue(count, 1);
1609        //isReadOnly
1610        m.ClearFlag();
1611        bool isReadOnly = m.IsReadOnly;
1612        ValidateMethod(m.GetFlagState(), TestMethodCalled.NotSet);
1613        ValidateValue(isReadOnly, false);
1614        //Remove
1615        m.ClearFlag();
1616        var rez = m.Remove(new KeyValuePair<int, int>(3, 4));
1617        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Remove);
1618        ValidateValue(rez, true);
1619        m.ClearFlag();
1620        rez = m.Remove(new KeyValuePair<int, int>(2, 3));
1621        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_HasKey);
1622        ValidateValue(rez, false);
1623        m.Add(1, 2);
1624        m.Add(2, 3);
1625        m.ClearFlag();
1626        m.Clear();
1627        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Clear);
1628        ValidateValue(m.Count, 0);
1629    }
1630
1631    static void TestIMapIntStructMembers()
1632    {
1633        Console.WriteLine(""===  IMapIntStruct  ==="");
1634        var m = new IMapIntStruct();
1635        var ud = new UserDefinedStruct()
1636        {
1637            Id = 10
1638        }
1639
1640        ;
1641        //Add
1642        m.ClearFlag();
1643        m.Add(1, ud);
1644        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Insert);
1645        ValidateValue(m.Count, 1);
1646        //ContainsKey
1647        m.ClearFlag();
1648        bool key = m.ContainsKey(1);
1649        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_HasKey);
1650        //Lookup
1651        m.ClearFlag();
1652        UserDefinedStruct val = m[1];
1653        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Lookup);
1654        ValidateValue(val.Id, 10);
1655        //Keys
1656        m.ClearFlag();
1657        var keys = m.Keys;
1658        ValidateMethod(m.GetFlagState(), TestMethodCalled.NotSet);
1659        //Values
1660        m.ClearFlag();
1661        var values = m.Values;
1662        ValidateMethod(m.GetFlagState(), TestMethodCalled.NotSet);
1663        //Lookup
1664        m.ClearFlag();
1665        UserDefinedStruct outVal;
1666        bool success = ((IDictionary<int, UserDefinedStruct>)m).TryGetValue(1, out outVal);
1667        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Lookup);
1668        ValidateValue(outVal.Id, ud.Id);
1669        ValidateValue(success, true);
1670        //Add
1671        m.ClearFlag();
1672        m.Add(new KeyValuePair<int, UserDefinedStruct>(3, new UserDefinedStruct()
1673        {
1674            Id = 4
1675        }
1676
1677        ));
1678        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Insert);
1679        ValidateValue(m.Count, 2);
1680        //Contains
1681        m.ClearFlag();
1682        bool contains = m.Contains(new KeyValuePair<int, UserDefinedStruct>(1, ud));
1683        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Lookup);
1684        ValidateValue(contains, true);
1685        //non-existant pair
1686        m.ClearFlag();
1687        contains = m.Contains(new KeyValuePair<int, UserDefinedStruct>(8, new UserDefinedStruct()));
1688        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_HasKey);
1689        ValidateValue(contains, false);
1690        //Remove
1691        m.ClearFlag();
1692        bool remove = m.Remove(3);
1693        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Remove);
1694        ValidateValue(m.Count, 1);
1695        ValidateValue(remove, true);
1696        //Count
1697        m.ClearFlag();
1698        int count = m.Count;
1699        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_get_Size);
1700        ValidateValue(count, 1);
1701        //isReadOnly
1702        m.ClearFlag();
1703        bool isReadOnly = m.IsReadOnly;
1704        ValidateMethod(m.GetFlagState(), TestMethodCalled.NotSet);
1705        ValidateValue(isReadOnly, false);
1706        //Remove
1707        m.ClearFlag();
1708        var rez = m.Remove(new KeyValuePair<int, UserDefinedStruct>(1, ud));
1709        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Remove);
1710        ValidateValue(rez, true);
1711        ValidateValue(m.Count, 0);
1712        //Clear
1713        m.Add(1, ud);
1714        m.Add(2, ud);
1715        m.ClearFlag();
1716        m.Clear();
1717        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Clear);
1718        ValidateValue(m.Count, 0);
1719    }
1720
1721    static void TestIMapExplicitAddMembers()
1722    {
1723        IMapExplicitAdd v = new IMapExplicitAdd();
1724        //Calling the user defined Add method
1725        v.ClearFlag();
1726        ((IMemberAdd2Args)v).Add(1, 1);
1727        ValidateMethod(v.GetFlagState(), TestMethodCalled.UserDef_Add);
1728        v.ClearFlag();
1729        ((IMemberAdd2Args)v).Add(2, 2);
1730        ValidateMethod(v.GetFlagState(), TestMethodCalled.UserDef_Add);
1731        //Calling the Interface Add's method
1732        v.ClearFlag();
1733        ((IDictionary<int, int>)v).Add(3, 3);
1734        ValidateMethod(v.GetFlagState(), TestMethodCalled.IMap_Insert);
1735        ValidateValue(v.Count, 3);
1736    }
1737
1738    static void TestIMapViewMembers()
1739    {
1740        var m = new IMapViewIntInt();
1741        m.ClearFlag();
1742        int count = m.Count;
1743        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_get_Size);
1744    }
1745
1746    static void TestIMapIntIMapViewIntStructMembers()
1747    {
1748        Console.WriteLine(""===  IMapIMapViewIntStruct  ==="");
1749        var m = new IMapIMapViewIntStruct();
1750        var ud = new UserDefinedStruct() { Id = 10 };
1751        //Add
1752        m.ClearFlag();
1753        m.Add(1, ud);
1754        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Insert);
1755        ValidateValue((m as IDictionary<int, UserDefinedStruct>).Count, 1);
1756        //ContainsKey
1757        m.ClearFlag();
1758        bool key = ((IDictionary<int, UserDefinedStruct>)m).ContainsKey(1);
1759        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_HasKey);
1760        //Lookup
1761        m.ClearFlag();
1762        UserDefinedStruct val = ((IDictionary<int, UserDefinedStruct>)m)[1];
1763        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Lookup);
1764        ValidateValue(val.Id, 10);
1765        //Keys
1766        m.ClearFlag();
1767        var keys = ((IDictionary<int, UserDefinedStruct>)m).Keys;
1768        ValidateMethod(m.GetFlagState(), TestMethodCalled.NotSet);
1769        //Values
1770        m.ClearFlag();
1771        var values = ((IDictionary<int, UserDefinedStruct>)m).Values;
1772        ValidateMethod(m.GetFlagState(), TestMethodCalled.NotSet);
1773        //Lookup
1774        m.ClearFlag();
1775        UserDefinedStruct outVal;
1776        bool success = ((IDictionary<int, UserDefinedStruct>)m).TryGetValue(1, out outVal);
1777        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Lookup);
1778        ValidateValue(success, true);
1779        //Add
1780        m.ClearFlag();
1781        m.Add(new KeyValuePair<int, UserDefinedStruct>(3, new UserDefinedStruct()
1782        {
1783            Id = 4
1784        }
1785
1786        ));
1787        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Insert);
1788        ValidateValue((m as IDictionary<int, UserDefinedStruct>).Count, 2);
1789        //Contains
1790        m.ClearFlag();
1791        bool contains = m.Contains(new KeyValuePair<int, UserDefinedStruct>(1, ud));
1792        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Lookup);
1793        ValidateValue(contains, true);
1794        //non-existant pair
1795        m.ClearFlag();
1796        contains = m.Contains(new KeyValuePair<int, UserDefinedStruct>(8, new UserDefinedStruct()));
1797        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_HasKey);
1798        ValidateValue(contains, false);
1799        //Remove
1800        m.ClearFlag();
1801        bool remove = m.Remove(3);
1802        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Remove);
1803        ValidateValue((m as IDictionary<int, UserDefinedStruct>).Count, 1);
1804        ValidateValue(remove, true);
1805        //Count
1806        m.ClearFlag();
1807        int count = (m as IDictionary<int, UserDefinedStruct>).Count;
1808        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_get_Size);
1809        ValidateValue(count, 1);
1810        //isReadOnly
1811        m.ClearFlag();
1812        bool isReadOnly = m.IsReadOnly;
1813        ValidateMethod(m.GetFlagState(), TestMethodCalled.NotSet);
1814        ValidateValue(isReadOnly, false);
1815        //Remove
1816        m.ClearFlag();
1817        var rez = m.Remove(new KeyValuePair<int, UserDefinedStruct>(1, ud));
1818        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Remove);
1819        ValidateValue(rez, true);
1820        ValidateValue((m as IDictionary<int, UserDefinedStruct>).Count, 0);
1821        //m.ClearFlag()
1822        //rez = m.Remove(New KeyValuePair(Of Integer, UserDefinedStruct)(3, ud))
1823        //ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_HasKey)
1824        //ValidateValue(rez, False)
1825        //Clear
1826        m.Add(1, ud);
1827        m.Add(2, ud);
1828        m.ClearFlag();
1829        m.Clear();
1830        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Clear);
1831        ValidateValue((m as IDictionary<int, UserDefinedStruct>).Count, 0);
1832        // IMapView members
1833        m.ClearFlag();
1834        count = ((IReadOnlyDictionary<int, UserDefinedStruct>)m).Count;
1835        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_get_Size);
1836    }
1837
1838    static int Main()
1839    {
1840        TestIMapIntIntMembers();
1841        TestIMapIntStructMembers();
1842        TestIMapExplicitAddMembers();
1843        TestIMapViewMembers();
1844        TestIMapIntIMapViewIntStructMembers();
1845
1846        Console.WriteLine(FailedCount);
1847        return FailedCount;
1848    }
1849}";
1850            var verifier = CompileAndVerify(source,
1851                additionalRefs: LegacyRefs,
1852                emitOptions: EmitOptions.RefEmitBug,
1853                //FIXME: Can't verify because the metadata adapter isn't implemented yet
1854                verify: false);
1855            verifier.VerifyDiagnostics(
1856                // (3,1): info CS8019: Unnecessary using directive.
1857                // using System.Reflection;
1858                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Reflection;"),
1859                // (4,1): info CS8019: Unnecessary using directive.
1860                // using System.Linq.Expressions;
1861                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq.Expressions;"),
1862                // (6,1): info CS8019: Unnecessary using directive.
1863                // using System.Linq;
1864                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq;"));
1865            verifier.VerifyIL("AllMembers.TestIMapIntIntMembers",
1866@"{
1867  // Code size      756 (0x2f4)
1868  .maxstack  4
1869  .locals init (int V_0, //val
1870  int V_1, //outVal
1871  bool V_2, //success
1872  bool V_3, //contains
1873  bool V_4, //remove
1874  int V_5, //count
1875  bool V_6, //isReadOnly
1876  bool V_7) //rez
1877  IL_0000:  ldstr      ""===  IMapIntInt  ===""
1878  IL_0005:  call       ""void System.Console.WriteLine(string)""
1879  IL_000a:  newobj     ""Windows.Languages.WinRTTest.IMapIntInt..ctor()""
1880  IL_000f:  dup
1881  IL_0010:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntInt.ClearFlag()""
1882  IL_0015:  dup
1883  IL_0016:  ldc.i4.1
1884  IL_0017:  ldc.i4.2
1885  IL_0018:  callvirt   ""void System.Collections.Generic.IDictionary<int, int>.Add(int, int)""
1886  IL_001d:  dup
1887  IL_001e:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntInt.GetFlagState()""
1888  IL_0023:  ldc.i4.s   21
1889  IL_0025:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
1890  IL_002a:  pop
1891  IL_002b:  dup
1892  IL_002c:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Count.get""
1893  IL_0031:  box        ""int""
1894  IL_0036:  ldc.i4.1
1895  IL_0037:  box        ""int""
1896  IL_003c:  call       ""bool AllMembers.ValidateValue(object, object)""
1897  IL_0041:  pop
1898  IL_0042:  dup
1899  IL_0043:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntInt.ClearFlag()""
1900  IL_0048:  dup
1901  IL_0049:  ldc.i4.1
1902  IL_004a:  callvirt   ""bool System.Collections.Generic.IDictionary<int, int>.ContainsKey(int)""
1903  IL_004f:  pop
1904  IL_0050:  dup
1905  IL_0051:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntInt.GetFlagState()""
1906  IL_0056:  ldc.i4.s   19
1907  IL_0058:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
1908  IL_005d:  pop
1909  IL_005e:  dup
1910  IL_005f:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntInt.ClearFlag()""
1911  IL_0064:  dup
1912  IL_0065:  ldc.i4.1
1913  IL_0066:  callvirt   ""int System.Collections.Generic.IDictionary<int, int>.this[int].get""
1914  IL_006b:  stloc.0
1915  IL_006c:  dup
1916  IL_006d:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntInt.GetFlagState()""
1917  IL_0072:  ldc.i4.s   17
1918  IL_0074:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
1919  IL_0079:  pop
1920  IL_007a:  ldloc.0
1921  IL_007b:  box        ""int""
1922  IL_0080:  ldc.i4.2
1923  IL_0081:  box        ""int""
1924  IL_0086:  call       ""bool AllMembers.ValidateValue(object, object)""
1925  IL_008b:  pop
1926  IL_008c:  dup
1927  IL_008d:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntInt.ClearFlag()""
1928  IL_0092:  dup
1929  IL_0093:  callvirt   ""System.Collections.Generic.ICollection<int> System.Collections.Generic.IDictionary<int, int>.Keys.get""
1930  IL_0098:  pop
1931  IL_0099:  dup
1932  IL_009a:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntInt.GetFlagState()""
1933  IL_009f:  ldc.i4.0
1934  IL_00a0:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
1935  IL_00a5:  pop
1936  IL_00a6:  dup
1937  IL_00a7:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntInt.ClearFlag()""
1938  IL_00ac:  dup
1939  IL_00ad:  callvirt   ""System.Collections.Generic.ICollection<int> System.Collections.Generic.IDictionary<int, int>.Values.get""
1940  IL_00b2:  pop
1941  IL_00b3:  dup
1942  IL_00b4:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntInt.GetFlagState()""
1943  IL_00b9:  ldc.i4.0
1944  IL_00ba:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
1945  IL_00bf:  pop
1946  IL_00c0:  dup
1947  IL_00c1:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntInt.ClearFlag()""
1948  IL_00c6:  dup
1949  IL_00c7:  ldc.i4.1
1950  IL_00c8:  ldloca.s   V_1
1951  IL_00ca:  callvirt   ""bool System.Collections.Generic.IDictionary<int, int>.TryGetValue(int, out int)""
1952  IL_00cf:  stloc.2
1953  IL_00d0:  dup
1954  IL_00d1:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntInt.GetFlagState()""
1955  IL_00d6:  ldc.i4.s   17
1956  IL_00d8:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
1957  IL_00dd:  pop
1958  IL_00de:  ldloc.1
1959  IL_00df:  box        ""int""
1960  IL_00e4:  ldc.i4.2
1961  IL_00e5:  box        ""int""
1962  IL_00ea:  call       ""bool AllMembers.ValidateValue(object, object)""
1963  IL_00ef:  pop
1964  IL_00f0:  ldloc.2
1965  IL_00f1:  box        ""bool""
1966  IL_00f6:  ldc.i4.1
1967  IL_00f7:  box        ""bool""
1968  IL_00fc:  call       ""bool AllMembers.ValidateValue(object, object)""
1969  IL_0101:  pop
1970  IL_0102:  dup
1971  IL_0103:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntInt.ClearFlag()""
1972  IL_0108:  dup
1973  IL_0109:  ldc.i4.3
1974  IL_010a:  ldc.i4.4
1975  IL_010b:  newobj     ""System.Collections.Generic.KeyValuePair<int, int>..ctor(int, int)""
1976  IL_0110:  callvirt   ""void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Add(System.Collections.Generic.KeyValuePair<int, int>)""
1977  IL_0115:  dup
1978  IL_0116:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntInt.GetFlagState()""
1979  IL_011b:  ldc.i4.s   21
1980  IL_011d:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
1981  IL_0122:  pop
1982  IL_0123:  dup
1983  IL_0124:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Count.get""
1984  IL_0129:  box        ""int""
1985  IL_012e:  ldc.i4.2
1986  IL_012f:  box        ""int""
1987  IL_0134:  call       ""bool AllMembers.ValidateValue(object, object)""
1988  IL_0139:  pop
1989  IL_013a:  dup
1990  IL_013b:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntInt.ClearFlag()""
1991  IL_0140:  dup
1992  IL_0141:  ldc.i4.3
1993  IL_0142:  ldc.i4.4
1994  IL_0143:  newobj     ""System.Collections.Generic.KeyValuePair<int, int>..ctor(int, int)""
1995  IL_0148:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Contains(System.Collections.Generic.KeyValuePair<int, int>)""
1996  IL_014d:  stloc.3
1997  IL_014e:  dup
1998  IL_014f:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntInt.GetFlagState()""
1999  IL_0154:  ldc.i4.s   17
2000  IL_0156:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2001  IL_015b:  pop
2002  IL_015c:  ldloc.3
2003  IL_015d:  box        ""bool""
2004  IL_0162:  ldc.i4.1
2005  IL_0163:  box        ""bool""
2006  IL_0168:  call       ""bool AllMembers.ValidateValue(object, object)""
2007  IL_016d:  pop
2008  IL_016e:  dup
2009  IL_016f:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntInt.ClearFlag()""
2010  IL_0174:  dup
2011  IL_0175:  ldc.i4.8
2012  IL_0176:  ldc.i4.s   9
2013  IL_0178:  newobj     ""System.Collections.Generic.KeyValuePair<int, int>..ctor(int, int)""
2014  IL_017d:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Contains(System.Collections.Generic.KeyValuePair<int, int>)""
2015  IL_0182:  stloc.3
2016  IL_0183:  dup
2017  IL_0184:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntInt.GetFlagState()""
2018  IL_0189:  ldc.i4.s   19
2019  IL_018b:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2020  IL_0190:  pop
2021  IL_0191:  ldloc.3
2022  IL_0192:  box        ""bool""
2023  IL_0197:  ldc.i4.0
2024  IL_0198:  box        ""bool""
2025  IL_019d:  call       ""bool AllMembers.ValidateValue(object, object)""
2026  IL_01a2:  pop
2027  IL_01a3:  dup
2028  IL_01a4:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntInt.ClearFlag()""
2029  IL_01a9:  dup
2030  IL_01aa:  ldc.i4.1
2031  IL_01ab:  callvirt   ""bool System.Collections.Generic.IDictionary<int, int>.Remove(int)""
2032  IL_01b0:  stloc.s    V_4
2033  IL_01b2:  dup
2034  IL_01b3:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntInt.GetFlagState()""
2035  IL_01b8:  ldc.i4.s   22
2036  IL_01ba:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2037  IL_01bf:  pop
2038  IL_01c0:  dup
2039  IL_01c1:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Count.get""
2040  IL_01c6:  box        ""int""
2041  IL_01cb:  ldc.i4.1
2042  IL_01cc:  box        ""int""
2043  IL_01d1:  call       ""bool AllMembers.ValidateValue(object, object)""
2044  IL_01d6:  pop
2045  IL_01d7:  ldloc.s    V_4
2046  IL_01d9:  box        ""bool""
2047  IL_01de:  ldc.i4.1
2048  IL_01df:  box        ""bool""
2049  IL_01e4:  call       ""bool AllMembers.ValidateValue(object, object)""
2050  IL_01e9:  pop
2051  IL_01ea:  dup
2052  IL_01eb:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntInt.ClearFlag()""
2053  IL_01f0:  dup
2054  IL_01f1:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Count.get""
2055  IL_01f6:  stloc.s    V_5
2056  IL_01f8:  dup
2057  IL_01f9:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntInt.GetFlagState()""
2058  IL_01fe:  ldc.i4.s   18
2059  IL_0200:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2060  IL_0205:  pop
2061  IL_0206:  ldloc.s    V_5
2062  IL_0208:  box        ""int""
2063  IL_020d:  ldc.i4.1
2064  IL_020e:  box        ""int""
2065  IL_0213:  call       ""bool AllMembers.ValidateValue(object, object)""
2066  IL_0218:  pop
2067  IL_0219:  dup
2068  IL_021a:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntInt.ClearFlag()""
2069  IL_021f:  dup
2070  IL_0220:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.IsReadOnly.get""
2071  IL_0225:  stloc.s    V_6
2072  IL_0227:  dup
2073  IL_0228:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntInt.GetFlagState()""
2074  IL_022d:  ldc.i4.0
2075  IL_022e:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2076  IL_0233:  pop
2077  IL_0234:  ldloc.s    V_6
2078  IL_0236:  box        ""bool""
2079  IL_023b:  ldc.i4.0
2080  IL_023c:  box        ""bool""
2081  IL_0241:  call       ""bool AllMembers.ValidateValue(object, object)""
2082  IL_0246:  pop
2083  IL_0247:  dup
2084  IL_0248:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntInt.ClearFlag()""
2085  IL_024d:  dup
2086  IL_024e:  ldc.i4.3
2087  IL_024f:  ldc.i4.4
2088  IL_0250:  newobj     ""System.Collections.Generic.KeyValuePair<int, int>..ctor(int, int)""
2089  IL_0255:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Remove(System.Collections.Generic.KeyValuePair<int, int>)""
2090  IL_025a:  stloc.s    V_7
2091  IL_025c:  dup
2092  IL_025d:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntInt.GetFlagState()""
2093  IL_0262:  ldc.i4.s   22
2094  IL_0264:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2095  IL_0269:  pop
2096  IL_026a:  ldloc.s    V_7
2097  IL_026c:  box        ""bool""
2098  IL_0271:  ldc.i4.1
2099  IL_0272:  box        ""bool""
2100  IL_0277:  call       ""bool AllMembers.ValidateValue(object, object)""
2101  IL_027c:  pop
2102  IL_027d:  dup
2103  IL_027e:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntInt.ClearFlag()""
2104  IL_0283:  dup
2105  IL_0284:  ldc.i4.2
2106  IL_0285:  ldc.i4.3
2107  IL_0286:  newobj     ""System.Collections.Generic.KeyValuePair<int, int>..ctor(int, int)""
2108  IL_028b:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Remove(System.Collections.Generic.KeyValuePair<int, int>)""
2109  IL_0290:  stloc.s    V_7
2110  IL_0292:  dup
2111  IL_0293:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntInt.GetFlagState()""
2112  IL_0298:  ldc.i4.s   19
2113  IL_029a:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2114  IL_029f:  pop
2115  IL_02a0:  ldloc.s    V_7
2116  IL_02a2:  box        ""bool""
2117  IL_02a7:  ldc.i4.0
2118  IL_02a8:  box        ""bool""
2119  IL_02ad:  call       ""bool AllMembers.ValidateValue(object, object)""
2120  IL_02b2:  pop
2121  IL_02b3:  dup
2122  IL_02b4:  ldc.i4.1
2123  IL_02b5:  ldc.i4.2
2124  IL_02b6:  callvirt   ""void System.Collections.Generic.IDictionary<int, int>.Add(int, int)""
2125  IL_02bb:  dup
2126  IL_02bc:  ldc.i4.2
2127  IL_02bd:  ldc.i4.3
2128  IL_02be:  callvirt   ""void System.Collections.Generic.IDictionary<int, int>.Add(int, int)""
2129  IL_02c3:  dup
2130  IL_02c4:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntInt.ClearFlag()""
2131  IL_02c9:  dup
2132  IL_02ca:  callvirt   ""void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Clear()""
2133  IL_02cf:  dup
2134  IL_02d0:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntInt.GetFlagState()""
2135  IL_02d5:  ldc.i4.s   23
2136  IL_02d7:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2137  IL_02dc:  pop
2138  IL_02dd:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Count.get""
2139  IL_02e2:  box        ""int""
2140  IL_02e7:  ldc.i4.0
2141  IL_02e8:  box        ""int""
2142  IL_02ed:  call       ""bool AllMembers.ValidateValue(object, object)""
2143  IL_02f2:  pop
2144  IL_02f3:  ret
2145}");
2146            verifier.VerifyIL("AllMembers.TestIMapIntStructMembers",
2147@"
2148{
2149  // Code size      790 (0x316)
2150  .maxstack  5
2151  .locals init (Windows.Languages.WinRTTest.UserDefinedStruct V_0, //ud
2152  Windows.Languages.WinRTTest.UserDefinedStruct V_1, //val
2153  Windows.Languages.WinRTTest.UserDefinedStruct V_2, //outVal
2154  bool V_3, //success
2155  bool V_4, //contains
2156  bool V_5, //remove
2157  int V_6, //count
2158  bool V_7, //isReadOnly
2159  bool V_8, //rez
2160  Windows.Languages.WinRTTest.UserDefinedStruct V_9)
2161  IL_0000:  ldstr      ""===  IMapIntStruct  ===""
2162  IL_0005:  call       ""void System.Console.WriteLine(string)""
2163  IL_000a:  newobj     ""Windows.Languages.WinRTTest.IMapIntStruct..ctor()""
2164  IL_000f:  ldloca.s   V_9
2165  IL_0011:  initobj    ""Windows.Languages.WinRTTest.UserDefinedStruct""
2166  IL_0017:  ldloca.s   V_9
2167  IL_0019:  ldc.i4.s   10
2168  IL_001b:  stfld      ""uint Windows.Languages.WinRTTest.UserDefinedStruct.Id""
2169  IL_0020:  ldloc.s    V_9
2170  IL_0022:  stloc.0
2171  IL_0023:  dup
2172  IL_0024:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntStruct.ClearFlag()""
2173  IL_0029:  dup
2174  IL_002a:  ldc.i4.1
2175  IL_002b:  ldloc.0
2176  IL_002c:  callvirt   ""void System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.Add(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
2177  IL_0031:  dup
2178  IL_0032:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntStruct.GetFlagState()""
2179  IL_0037:  ldc.i4.s   21
2180  IL_0039:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2181  IL_003e:  pop
2182  IL_003f:  dup
2183  IL_0040:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Count.get""
2184  IL_0045:  box        ""int""
2185  IL_004a:  ldc.i4.1
2186  IL_004b:  box        ""int""
2187  IL_0050:  call       ""bool AllMembers.ValidateValue(object, object)""
2188  IL_0055:  pop
2189  IL_0056:  dup
2190  IL_0057:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntStruct.ClearFlag()""
2191  IL_005c:  dup
2192  IL_005d:  ldc.i4.1
2193  IL_005e:  callvirt   ""bool System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.ContainsKey(int)""
2194  IL_0063:  pop
2195  IL_0064:  dup
2196  IL_0065:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntStruct.GetFlagState()""
2197  IL_006a:  ldc.i4.s   19
2198  IL_006c:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2199  IL_0071:  pop
2200  IL_0072:  dup
2201  IL_0073:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntStruct.ClearFlag()""
2202  IL_0078:  dup
2203  IL_0079:  ldc.i4.1
2204  IL_007a:  callvirt   ""Windows.Languages.WinRTTest.UserDefinedStruct System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.this[int].get""
2205  IL_007f:  stloc.1
2206  IL_0080:  dup
2207  IL_0081:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntStruct.GetFlagState()""
2208  IL_0086:  ldc.i4.s   17
2209  IL_0088:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2210  IL_008d:  pop
2211  IL_008e:  ldloc.1
2212  IL_008f:  ldfld      ""uint Windows.Languages.WinRTTest.UserDefinedStruct.Id""
2213  IL_0094:  box        ""uint""
2214  IL_0099:  ldc.i4.s   10
2215  IL_009b:  box        ""int""
2216  IL_00a0:  call       ""bool AllMembers.ValidateValue(object, object)""
2217  IL_00a5:  pop
2218  IL_00a6:  dup
2219  IL_00a7:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntStruct.ClearFlag()""
2220  IL_00ac:  dup
2221  IL_00ad:  callvirt   ""System.Collections.Generic.ICollection<int> System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.Keys.get""
2222  IL_00b2:  pop
2223  IL_00b3:  dup
2224  IL_00b4:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntStruct.GetFlagState()""
2225  IL_00b9:  ldc.i4.0
2226  IL_00ba:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2227  IL_00bf:  pop
2228  IL_00c0:  dup
2229  IL_00c1:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntStruct.ClearFlag()""
2230  IL_00c6:  dup
2231  IL_00c7:  callvirt   ""System.Collections.Generic.ICollection<Windows.Languages.WinRTTest.UserDefinedStruct> System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.Values.get""
2232  IL_00cc:  pop
2233  IL_00cd:  dup
2234  IL_00ce:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntStruct.GetFlagState()""
2235  IL_00d3:  ldc.i4.0
2236  IL_00d4:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2237  IL_00d9:  pop
2238  IL_00da:  dup
2239  IL_00db:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntStruct.ClearFlag()""
2240  IL_00e0:  dup
2241  IL_00e1:  ldc.i4.1
2242  IL_00e2:  ldloca.s   V_2
2243  IL_00e4:  callvirt   ""bool System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.TryGetValue(int, out Windows.Languages.WinRTTest.UserDefinedStruct)""
2244  IL_00e9:  stloc.3
2245  IL_00ea:  dup
2246  IL_00eb:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntStruct.GetFlagState()""
2247  IL_00f0:  ldc.i4.s   17
2248  IL_00f2:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2249  IL_00f7:  pop
2250  IL_00f8:  ldloc.2
2251  IL_00f9:  ldfld      ""uint Windows.Languages.WinRTTest.UserDefinedStruct.Id""
2252  IL_00fe:  box        ""uint""
2253  IL_0103:  ldloc.0
2254  IL_0104:  ldfld      ""uint Windows.Languages.WinRTTest.UserDefinedStruct.Id""
2255  IL_0109:  box        ""uint""
2256  IL_010e:  call       ""bool AllMembers.ValidateValue(object, object)""
2257  IL_0113:  pop
2258  IL_0114:  ldloc.3
2259  IL_0115:  box        ""bool""
2260  IL_011a:  ldc.i4.1
2261  IL_011b:  box        ""bool""
2262  IL_0120:  call       ""bool AllMembers.ValidateValue(object, object)""
2263  IL_0125:  pop
2264  IL_0126:  dup
2265  IL_0127:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntStruct.ClearFlag()""
2266  IL_012c:  dup
2267  IL_012d:  ldc.i4.3
2268  IL_012e:  ldloca.s   V_9
2269  IL_0130:  initobj    ""Windows.Languages.WinRTTest.UserDefinedStruct""
2270  IL_0136:  ldloca.s   V_9
2271  IL_0138:  ldc.i4.4
2272  IL_0139:  stfld      ""uint Windows.Languages.WinRTTest.UserDefinedStruct.Id""
2273  IL_013e:  ldloc.s    V_9
2274  IL_0140:  newobj     ""System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>..ctor(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
2275  IL_0145:  callvirt   ""void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Add(System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>)""
2276  IL_014a:  dup
2277  IL_014b:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntStruct.GetFlagState()""
2278  IL_0150:  ldc.i4.s   21
2279  IL_0152:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2280  IL_0157:  pop
2281  IL_0158:  dup
2282  IL_0159:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Count.get""
2283  IL_015e:  box        ""int""
2284  IL_0163:  ldc.i4.2
2285  IL_0164:  box        ""int""
2286  IL_0169:  call       ""bool AllMembers.ValidateValue(object, object)""
2287  IL_016e:  pop
2288  IL_016f:  dup
2289  IL_0170:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntStruct.ClearFlag()""
2290  IL_0175:  dup
2291  IL_0176:  ldc.i4.1
2292  IL_0177:  ldloc.0
2293  IL_0178:  newobj     ""System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>..ctor(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
2294  IL_017d:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Contains(System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>)""
2295  IL_0182:  stloc.s    V_4
2296  IL_0184:  dup
2297  IL_0185:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntStruct.GetFlagState()""
2298  IL_018a:  ldc.i4.s   17
2299  IL_018c:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2300  IL_0191:  pop
2301  IL_0192:  ldloc.s    V_4
2302  IL_0194:  box        ""bool""
2303  IL_0199:  ldc.i4.1
2304  IL_019a:  box        ""bool""
2305  IL_019f:  call       ""bool AllMembers.ValidateValue(object, object)""
2306  IL_01a4:  pop
2307  IL_01a5:  dup
2308  IL_01a6:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntStruct.ClearFlag()""
2309  IL_01ab:  dup
2310  IL_01ac:  ldc.i4.8
2311  IL_01ad:  ldloca.s   V_9
2312  IL_01af:  initobj    ""Windows.Languages.WinRTTest.UserDefinedStruct""
2313  IL_01b5:  ldloc.s    V_9
2314  IL_01b7:  newobj     ""System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>..ctor(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
2315  IL_01bc:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Contains(System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>)""
2316  IL_01c1:  stloc.s    V_4
2317  IL_01c3:  dup
2318  IL_01c4:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntStruct.GetFlagState()""
2319  IL_01c9:  ldc.i4.s   19
2320  IL_01cb:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2321  IL_01d0:  pop
2322  IL_01d1:  ldloc.s    V_4
2323  IL_01d3:  box        ""bool""
2324  IL_01d8:  ldc.i4.0
2325  IL_01d9:  box        ""bool""
2326  IL_01de:  call       ""bool AllMembers.ValidateValue(object, object)""
2327  IL_01e3:  pop
2328  IL_01e4:  dup
2329  IL_01e5:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntStruct.ClearFlag()""
2330  IL_01ea:  dup
2331  IL_01eb:  ldc.i4.3
2332  IL_01ec:  callvirt   ""bool System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.Remove(int)""
2333  IL_01f1:  stloc.s    V_5
2334  IL_01f3:  dup
2335  IL_01f4:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntStruct.GetFlagState()""
2336  IL_01f9:  ldc.i4.s   22
2337  IL_01fb:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2338  IL_0200:  pop
2339  IL_0201:  dup
2340  IL_0202:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Count.get""
2341  IL_0207:  box        ""int""
2342  IL_020c:  ldc.i4.1
2343  IL_020d:  box        ""int""
2344  IL_0212:  call       ""bool AllMembers.ValidateValue(object, object)""
2345  IL_0217:  pop
2346  IL_0218:  ldloc.s    V_5
2347  IL_021a:  box        ""bool""
2348  IL_021f:  ldc.i4.1
2349  IL_0220:  box        ""bool""
2350  IL_0225:  call       ""bool AllMembers.ValidateValue(object, object)""
2351  IL_022a:  pop
2352  IL_022b:  dup
2353  IL_022c:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntStruct.ClearFlag()""
2354  IL_0231:  dup
2355  IL_0232:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Count.get""
2356  IL_0237:  stloc.s    V_6
2357  IL_0239:  dup
2358  IL_023a:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntStruct.GetFlagState()""
2359  IL_023f:  ldc.i4.s   18
2360  IL_0241:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2361  IL_0246:  pop
2362  IL_0247:  ldloc.s    V_6
2363  IL_0249:  box        ""int""
2364  IL_024e:  ldc.i4.1
2365  IL_024f:  box        ""int""
2366  IL_0254:  call       ""bool AllMembers.ValidateValue(object, object)""
2367  IL_0259:  pop
2368  IL_025a:  dup
2369  IL_025b:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntStruct.ClearFlag()""
2370  IL_0260:  dup
2371  IL_0261:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.IsReadOnly.get""
2372  IL_0266:  stloc.s    V_7
2373  IL_0268:  dup
2374  IL_0269:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntStruct.GetFlagState()""
2375  IL_026e:  ldc.i4.0
2376  IL_026f:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2377  IL_0274:  pop
2378  IL_0275:  ldloc.s    V_7
2379  IL_0277:  box        ""bool""
2380  IL_027c:  ldc.i4.0
2381  IL_027d:  box        ""bool""
2382  IL_0282:  call       ""bool AllMembers.ValidateValue(object, object)""
2383  IL_0287:  pop
2384  IL_0288:  dup
2385  IL_0289:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntStruct.ClearFlag()""
2386  IL_028e:  dup
2387  IL_028f:  ldc.i4.1
2388  IL_0290:  ldloc.0
2389  IL_0291:  newobj     ""System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>..ctor(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
2390  IL_0296:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Remove(System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>)""
2391  IL_029b:  stloc.s    V_8
2392  IL_029d:  dup
2393  IL_029e:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntStruct.GetFlagState()""
2394  IL_02a3:  ldc.i4.s   22
2395  IL_02a5:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2396  IL_02aa:  pop
2397  IL_02ab:  ldloc.s    V_8
2398  IL_02ad:  box        ""bool""
2399  IL_02b2:  ldc.i4.1
2400  IL_02b3:  box        ""bool""
2401  IL_02b8:  call       ""bool AllMembers.ValidateValue(object, object)""
2402  IL_02bd:  pop
2403  IL_02be:  dup
2404  IL_02bf:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Count.get""
2405  IL_02c4:  box        ""int""
2406  IL_02c9:  ldc.i4.0
2407  IL_02ca:  box        ""int""
2408  IL_02cf:  call       ""bool AllMembers.ValidateValue(object, object)""
2409  IL_02d4:  pop
2410  IL_02d5:  dup
2411  IL_02d6:  ldc.i4.1
2412  IL_02d7:  ldloc.0
2413  IL_02d8:  callvirt   ""void System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.Add(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
2414  IL_02dd:  dup
2415  IL_02de:  ldc.i4.2
2416  IL_02df:  ldloc.0
2417  IL_02e0:  callvirt   ""void System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.Add(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
2418  IL_02e5:  dup
2419  IL_02e6:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntStruct.ClearFlag()""
2420  IL_02eb:  dup
2421  IL_02ec:  callvirt   ""void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Clear()""
2422  IL_02f1:  dup
2423  IL_02f2:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntStruct.GetFlagState()""
2424  IL_02f7:  ldc.i4.s   23
2425  IL_02f9:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2426  IL_02fe:  pop
2427  IL_02ff:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Count.get""
2428  IL_0304:  box        ""int""
2429  IL_0309:  ldc.i4.0
2430  IL_030a:  box        ""int""
2431  IL_030f:  call       ""bool AllMembers.ValidateValue(object, object)""
2432  IL_0314:  pop
2433  IL_0315:  ret
2434}
2435");
2436            verifier.VerifyIL("AllMembers.TestIMapExplicitAddMembers",
2437@"{
2438  // Code size      112 (0x70)
2439  .maxstack  4
2440  IL_0000:  newobj     ""Windows.Languages.WinRTTest.IMapExplicitAdd..ctor()""
2441  IL_0005:  dup
2442  IL_0006:  callvirt   ""void Windows.Languages.WinRTTest.IMapExplicitAdd.ClearFlag()""
2443  IL_000b:  dup
2444  IL_000c:  ldc.i4.1
2445  IL_000d:  ldc.i4.1
2446  IL_000e:  callvirt   ""void Windows.Languages.WinRTTest.IMemberAdd2Args.Add(int, int)""
2447  IL_0013:  dup
2448  IL_0014:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapExplicitAdd.GetFlagState()""
2449  IL_0019:  ldc.i4.s   25
2450  IL_001b:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2451  IL_0020:  pop
2452  IL_0021:  dup
2453  IL_0022:  callvirt   ""void Windows.Languages.WinRTTest.IMapExplicitAdd.ClearFlag()""
2454  IL_0027:  dup
2455  IL_0028:  ldc.i4.2
2456  IL_0029:  ldc.i4.2
2457  IL_002a:  callvirt   ""void Windows.Languages.WinRTTest.IMemberAdd2Args.Add(int, int)""
2458  IL_002f:  dup
2459  IL_0030:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapExplicitAdd.GetFlagState()""
2460  IL_0035:  ldc.i4.s   25
2461  IL_0037:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2462  IL_003c:  pop
2463  IL_003d:  dup
2464  IL_003e:  callvirt   ""void Windows.Languages.WinRTTest.IMapExplicitAdd.ClearFlag()""
2465  IL_0043:  dup
2466  IL_0044:  ldc.i4.3
2467  IL_0045:  ldc.i4.3
2468  IL_0046:  callvirt   ""void System.Collections.Generic.IDictionary<int, int>.Add(int, int)""
2469  IL_004b:  dup
2470  IL_004c:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapExplicitAdd.GetFlagState()""
2471  IL_0051:  ldc.i4.s   21
2472  IL_0053:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2473  IL_0058:  pop
2474  IL_0059:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Count.get""
2475  IL_005e:  box        ""int""
2476  IL_0063:  ldc.i4.3
2477  IL_0064:  box        ""int""
2478  IL_0069:  call       ""bool AllMembers.ValidateValue(object, object)""
2479  IL_006e:  pop
2480  IL_006f:  ret
2481}");
2482            verifier.VerifyIL("AllMembers.TestIMapViewMembers",
2483@"{
2484  // Code size       32 (0x20)
2485  .maxstack  2
2486  IL_0000:  newobj     ""Windows.Languages.WinRTTest.IMapViewIntInt..ctor()""
2487  IL_0005:  dup
2488  IL_0006:  callvirt   ""void Windows.Languages.WinRTTest.IMapViewIntInt.ClearFlag()""
2489  IL_000b:  dup
2490  IL_000c:  callvirt   ""int System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<int, int>>.Count.get""
2491  IL_0011:  pop
2492  IL_0012:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapViewIntInt.GetFlagState()""
2493  IL_0017:  ldc.i4.s   18
2494  IL_0019:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2495  IL_001e:  pop
2496  IL_001f:  ret
2497}");
2498            verifier.VerifyIL("AllMembers.TestIMapIntIMapViewIntStructMembers",
2499@"
2500{
2501  // Code size      790 (0x316)
2502  .maxstack  5
2503  .locals init (Windows.Languages.WinRTTest.UserDefinedStruct V_0, //ud
2504  Windows.Languages.WinRTTest.UserDefinedStruct V_1, //val
2505  Windows.Languages.WinRTTest.UserDefinedStruct V_2, //outVal
2506  bool V_3, //success
2507  bool V_4, //contains
2508  bool V_5, //remove
2509  int V_6, //count
2510  bool V_7, //isReadOnly
2511  bool V_8, //rez
2512  Windows.Languages.WinRTTest.UserDefinedStruct V_9)
2513  IL_0000:  ldstr      ""===  IMapIMapViewIntStruct  ===""
2514  IL_0005:  call       ""void System.Console.WriteLine(string)""
2515  IL_000a:  newobj     ""Windows.Languages.WinRTTest.IMapIMapViewIntStruct..ctor()""
2516  IL_000f:  ldloca.s   V_9
2517  IL_0011:  initobj    ""Windows.Languages.WinRTTest.UserDefinedStruct""
2518  IL_0017:  ldloca.s   V_9
2519  IL_0019:  ldc.i4.s   10
2520  IL_001b:  stfld      ""uint Windows.Languages.WinRTTest.UserDefinedStruct.Id""
2521  IL_0020:  ldloc.s    V_9
2522  IL_0022:  stloc.0
2523  IL_0023:  dup
2524  IL_0024:  callvirt   ""void Windows.Languages.WinRTTest.IMapIMapViewIntStruct.ClearFlag()""
2525  IL_0029:  dup
2526  IL_002a:  ldc.i4.1
2527  IL_002b:  ldloc.0
2528  IL_002c:  callvirt   ""void System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.Add(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
2529  IL_0031:  dup
2530  IL_0032:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIMapViewIntStruct.GetFlagState()""
2531  IL_0037:  ldc.i4.s   21
2532  IL_0039:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2533  IL_003e:  pop
2534  IL_003f:  dup
2535  IL_0040:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Count.get""
2536  IL_0045:  box        ""int""
2537  IL_004a:  ldc.i4.1
2538  IL_004b:  box        ""int""
2539  IL_0050:  call       ""bool AllMembers.ValidateValue(object, object)""
2540  IL_0055:  pop
2541  IL_0056:  dup
2542  IL_0057:  callvirt   ""void Windows.Languages.WinRTTest.IMapIMapViewIntStruct.ClearFlag()""
2543  IL_005c:  dup
2544  IL_005d:  ldc.i4.1
2545  IL_005e:  callvirt   ""bool System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.ContainsKey(int)""
2546  IL_0063:  pop
2547  IL_0064:  dup
2548  IL_0065:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIMapViewIntStruct.GetFlagState()""
2549  IL_006a:  ldc.i4.s   19
2550  IL_006c:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2551  IL_0071:  pop
2552  IL_0072:  dup
2553  IL_0073:  callvirt   ""void Windows.Languages.WinRTTest.IMapIMapViewIntStruct.ClearFlag()""
2554  IL_0078:  dup
2555  IL_0079:  ldc.i4.1
2556  IL_007a:  callvirt   ""Windows.Languages.WinRTTest.UserDefinedStruct System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.this[int].get""
2557  IL_007f:  stloc.1
2558  IL_0080:  dup
2559  IL_0081:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIMapViewIntStruct.GetFlagState()""
2560  IL_0086:  ldc.i4.s   17
2561  IL_0088:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2562  IL_008d:  pop
2563  IL_008e:  ldloc.1
2564  IL_008f:  ldfld      ""uint Windows.Languages.WinRTTest.UserDefinedStruct.Id""
2565  IL_0094:  box        ""uint""
2566  IL_0099:  ldc.i4.s   10
2567  IL_009b:  box        ""int""
2568  IL_00a0:  call       ""bool AllMembers.ValidateValue(object, object)""
2569  IL_00a5:  pop
2570  IL_00a6:  dup
2571  IL_00a7:  callvirt   ""void Windows.Languages.WinRTTest.IMapIMapViewIntStruct.ClearFlag()""
2572  IL_00ac:  dup
2573  IL_00ad:  callvirt   ""System.Collections.Generic.ICollection<int> System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.Keys.get""
2574  IL_00b2:  pop
2575  IL_00b3:  dup
2576  IL_00b4:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIMapViewIntStruct.GetFlagState()""
2577  IL_00b9:  ldc.i4.0
2578  IL_00ba:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2579  IL_00bf:  pop
2580  IL_00c0:  dup
2581  IL_00c1:  callvirt   ""void Windows.Languages.WinRTTest.IMapIMapViewIntStruct.ClearFlag()""
2582  IL_00c6:  dup
2583  IL_00c7:  callvirt   ""System.Collections.Generic.ICollection<Windows.Languages.WinRTTest.UserDefinedStruct> System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.Values.get""
2584  IL_00cc:  pop
2585  IL_00cd:  dup
2586  IL_00ce:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIMapViewIntStruct.GetFlagState()""
2587  IL_00d3:  ldc.i4.0
2588  IL_00d4:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2589  IL_00d9:  pop
2590  IL_00da:  dup
2591  IL_00db:  callvirt   ""void Windows.Languages.WinRTTest.IMapIMapViewIntStruct.ClearFlag()""
2592  IL_00e0:  dup
2593  IL_00e1:  ldc.i4.1
2594  IL_00e2:  ldloca.s   V_2
2595  IL_00e4:  callvirt   ""bool System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.TryGetValue(int, out Windows.Languages.WinRTTest.UserDefinedStruct)""
2596  IL_00e9:  stloc.3
2597  IL_00ea:  dup
2598  IL_00eb:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIMapViewIntStruct.GetFlagState()""
2599  IL_00f0:  ldc.i4.s   17
2600  IL_00f2:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2601  IL_00f7:  pop
2602  IL_00f8:  ldloc.3
2603  IL_00f9:  box        ""bool""
2604  IL_00fe:  ldc.i4.1
2605  IL_00ff:  box        ""bool""
2606  IL_0104:  call       ""bool AllMembers.ValidateValue(object, object)""
2607  IL_0109:  pop
2608  IL_010a:  dup
2609  IL_010b:  callvirt   ""void Windows.Languages.WinRTTest.IMapIMapViewIntStruct.ClearFlag()""
2610  IL_0110:  dup
2611  IL_0111:  ldc.i4.3
2612  IL_0112:  ldloca.s   V_9
2613  IL_0114:  initobj    ""Windows.Languages.WinRTTest.UserDefinedStruct""
2614  IL_011a:  ldloca.s   V_9
2615  IL_011c:  ldc.i4.4
2616  IL_011d:  stfld      ""uint Windows.Languages.WinRTTest.UserDefinedStruct.Id""
2617  IL_0122:  ldloc.s    V_9
2618  IL_0124:  newobj     ""System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>..ctor(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
2619  IL_0129:  callvirt   ""void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Add(System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>)""
2620  IL_012e:  dup
2621  IL_012f:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIMapViewIntStruct.GetFlagState()""
2622  IL_0134:  ldc.i4.s   21
2623  IL_0136:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2624  IL_013b:  pop
2625  IL_013c:  dup
2626  IL_013d:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Count.get""
2627  IL_0142:  box        ""int""
2628  IL_0147:  ldc.i4.2
2629  IL_0148:  box        ""int""
2630  IL_014d:  call       ""bool AllMembers.ValidateValue(object, object)""
2631  IL_0152:  pop
2632  IL_0153:  dup
2633  IL_0154:  callvirt   ""void Windows.Languages.WinRTTest.IMapIMapViewIntStruct.ClearFlag()""
2634  IL_0159:  dup
2635  IL_015a:  ldc.i4.1
2636  IL_015b:  ldloc.0
2637  IL_015c:  newobj     ""System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>..ctor(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
2638  IL_0161:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Contains(System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>)""
2639  IL_0166:  stloc.s    V_4
2640  IL_0168:  dup
2641  IL_0169:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIMapViewIntStruct.GetFlagState()""
2642  IL_016e:  ldc.i4.s   17
2643  IL_0170:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2644  IL_0175:  pop
2645  IL_0176:  ldloc.s    V_4
2646  IL_0178:  box        ""bool""
2647  IL_017d:  ldc.i4.1
2648  IL_017e:  box        ""bool""
2649  IL_0183:  call       ""bool AllMembers.ValidateValue(object, object)""
2650  IL_0188:  pop
2651  IL_0189:  dup
2652  IL_018a:  callvirt   ""void Windows.Languages.WinRTTest.IMapIMapViewIntStruct.ClearFlag()""
2653  IL_018f:  dup
2654  IL_0190:  ldc.i4.8
2655  IL_0191:  ldloca.s   V_9
2656  IL_0193:  initobj    ""Windows.Languages.WinRTTest.UserDefinedStruct""
2657  IL_0199:  ldloc.s    V_9
2658  IL_019b:  newobj     ""System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>..ctor(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
2659  IL_01a0:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Contains(System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>)""
2660  IL_01a5:  stloc.s    V_4
2661  IL_01a7:  dup
2662  IL_01a8:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIMapViewIntStruct.GetFlagState()""
2663  IL_01ad:  ldc.i4.s   19
2664  IL_01af:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2665  IL_01b4:  pop
2666  IL_01b5:  ldloc.s    V_4
2667  IL_01b7:  box        ""bool""
2668  IL_01bc:  ldc.i4.0
2669  IL_01bd:  box        ""bool""
2670  IL_01c2:  call       ""bool AllMembers.ValidateValue(object, object)""
2671  IL_01c7:  pop
2672  IL_01c8:  dup
2673  IL_01c9:  callvirt   ""void Windows.Languages.WinRTTest.IMapIMapViewIntStruct.ClearFlag()""
2674  IL_01ce:  dup
2675  IL_01cf:  ldc.i4.3
2676  IL_01d0:  callvirt   ""bool System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.Remove(int)""
2677  IL_01d5:  stloc.s    V_5
2678  IL_01d7:  dup
2679  IL_01d8:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIMapViewIntStruct.GetFlagState()""
2680  IL_01dd:  ldc.i4.s   22
2681  IL_01df:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2682  IL_01e4:  pop
2683  IL_01e5:  dup
2684  IL_01e6:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Count.get""
2685  IL_01eb:  box        ""int""
2686  IL_01f0:  ldc.i4.1
2687  IL_01f1:  box        ""int""
2688  IL_01f6:  call       ""bool AllMembers.ValidateValue(object, object)""
2689  IL_01fb:  pop
2690  IL_01fc:  ldloc.s    V_5
2691  IL_01fe:  box        ""bool""
2692  IL_0203:  ldc.i4.1
2693  IL_0204:  box        ""bool""
2694  IL_0209:  call       ""bool AllMembers.ValidateValue(object, object)""
2695  IL_020e:  pop
2696  IL_020f:  dup
2697  IL_0210:  callvirt   ""void Windows.Languages.WinRTTest.IMapIMapViewIntStruct.ClearFlag()""
2698  IL_0215:  dup
2699  IL_0216:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Count.get""
2700  IL_021b:  stloc.s    V_6
2701  IL_021d:  dup
2702  IL_021e:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIMapViewIntStruct.GetFlagState()""
2703  IL_0223:  ldc.i4.s   18
2704  IL_0225:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2705  IL_022a:  pop
2706  IL_022b:  ldloc.s    V_6
2707  IL_022d:  box        ""int""
2708  IL_0232:  ldc.i4.1
2709  IL_0233:  box        ""int""
2710  IL_0238:  call       ""bool AllMembers.ValidateValue(object, object)""
2711  IL_023d:  pop
2712  IL_023e:  dup
2713  IL_023f:  callvirt   ""void Windows.Languages.WinRTTest.IMapIMapViewIntStruct.ClearFlag()""
2714  IL_0244:  dup
2715  IL_0245:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.IsReadOnly.get""
2716  IL_024a:  stloc.s    V_7
2717  IL_024c:  dup
2718  IL_024d:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIMapViewIntStruct.GetFlagState()""
2719  IL_0252:  ldc.i4.0
2720  IL_0253:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2721  IL_0258:  pop
2722  IL_0259:  ldloc.s    V_7
2723  IL_025b:  box        ""bool""
2724  IL_0260:  ldc.i4.0
2725  IL_0261:  box        ""bool""
2726  IL_0266:  call       ""bool AllMembers.ValidateValue(object, object)""
2727  IL_026b:  pop
2728  IL_026c:  dup
2729  IL_026d:  callvirt   ""void Windows.Languages.WinRTTest.IMapIMapViewIntStruct.ClearFlag()""
2730  IL_0272:  dup
2731  IL_0273:  ldc.i4.1
2732  IL_0274:  ldloc.0
2733  IL_0275:  newobj     ""System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>..ctor(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
2734  IL_027a:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Remove(System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>)""
2735  IL_027f:  stloc.s    V_8
2736  IL_0281:  dup
2737  IL_0282:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIMapViewIntStruct.GetFlagState()""
2738  IL_0287:  ldc.i4.s   22
2739  IL_0289:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2740  IL_028e:  pop
2741  IL_028f:  ldloc.s    V_8
2742  IL_0291:  box        ""bool""
2743  IL_0296:  ldc.i4.1
2744  IL_0297:  box        ""bool""
2745  IL_029c:  call       ""bool AllMembers.ValidateValue(object, object)""
2746  IL_02a1:  pop
2747  IL_02a2:  dup
2748  IL_02a3:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Count.get""
2749  IL_02a8:  box        ""int""
2750  IL_02ad:  ldc.i4.0
2751  IL_02ae:  box        ""int""
2752  IL_02b3:  call       ""bool AllMembers.ValidateValue(object, object)""
2753  IL_02b8:  pop
2754  IL_02b9:  dup
2755  IL_02ba:  ldc.i4.1
2756  IL_02bb:  ldloc.0
2757  IL_02bc:  callvirt   ""void System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.Add(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
2758  IL_02c1:  dup
2759  IL_02c2:  ldc.i4.2
2760  IL_02c3:  ldloc.0
2761  IL_02c4:  callvirt   ""void System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.Add(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
2762  IL_02c9:  dup
2763  IL_02ca:  callvirt   ""void Windows.Languages.WinRTTest.IMapIMapViewIntStruct.ClearFlag()""
2764  IL_02cf:  dup
2765  IL_02d0:  callvirt   ""void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Clear()""
2766  IL_02d5:  dup
2767  IL_02d6:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIMapViewIntStruct.GetFlagState()""
2768  IL_02db:  ldc.i4.s   23
2769  IL_02dd:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2770  IL_02e2:  pop
2771  IL_02e3:  dup
2772  IL_02e4:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Count.get""
2773  IL_02e9:  box        ""int""
2774  IL_02ee:  ldc.i4.0
2775  IL_02ef:  box        ""int""
2776  IL_02f4:  call       ""bool AllMembers.ValidateValue(object, object)""
2777  IL_02f9:  pop
2778  IL_02fa:  dup
2779  IL_02fb:  callvirt   ""void Windows.Languages.WinRTTest.IMapIMapViewIntStruct.ClearFlag()""
2780  IL_0300:  dup
2781  IL_0301:  callvirt   ""int System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Count.get""
2782  IL_0306:  stloc.s    V_6
2783  IL_0308:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIMapViewIntStruct.GetFlagState()""
2784  IL_030d:  ldc.i4.s   18
2785  IL_030f:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
2786  IL_0314:  pop
2787  IL_0315:  ret
2788}
2789");
2790        }
2791
2792        [Fact]
2793        public void LegacyCollectionTest04()
2794        {
2795            var source =
2796@"using Windows.Languages.WinRTTest;
2797using System.Collections.Generic;
2798using System.Reflection;
2799using System.Linq.Expressions;
2800using System;
2801using System.Linq;
2802
2803class AllMembers
2804{
2805    private static int FailedCount = 0;
2806    private static bool ValidateMethod(TestMethodCalled actual, TestMethodCalled expected)
2807    {
2808        var temp = Console.ForegroundColor;
2809        if (actual != expected)
2810        {
2811            FailedCount++;
2812            Console.ForegroundColor = ConsoleColor.Red;
2813            Console.Write(""FAIL:  "");
2814        }
2815        else
2816        {
2817            Console.ForegroundColor = ConsoleColor.Green;
2818            Console.Write(""PASS:  "");
2819        }
2820
2821        Console.ForegroundColor = temp;
2822        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
2823        return actual == expected;
2824    }
2825
2826    private static bool ValidateValue(object actual, object expected)
2827    {
2828        var temp = Console.ForegroundColor;
2829        if (actual.ToString() != expected.ToString())
2830        {
2831            FailedCount++;
2832            Console.ForegroundColor = ConsoleColor.Red;
2833            Console.Write(""FAIL:  "");
2834        }
2835        else
2836        {
2837            Console.ForegroundColor = ConsoleColor.Green;
2838            Console.Write(""PASS:  "");
2839        }
2840
2841        Console.ForegroundColor = temp;
2842        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
2843        return actual.ToString() == expected.ToString();
2844    }
2845
2846    static void TestIVectorIntIVectorViewIntIMapIntIntIMapViewIntIntMembers()
2847    {
2848        var v = new IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt();
2849        //Add
2850        v.ClearFlag();
2851        v.Add(1);
2852        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Append);
2853        ValidateValue((v as IList<int>)[0], 1);
2854        //Contains
2855        v.ClearFlag();
2856        bool b = v.Contains(1);
2857        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
2858        ValidateValue(b, true);
2859        //CopyTo
2860        v.ClearFlag();
2861        int[] arr = new int[10];
2862        v.CopyTo(arr, 0);
2863        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
2864        ValidateValue(arr[0], 1);
2865        ValidateValue(arr[1], 0); //there should be nothing there! :)
2866        //GetEnumerator
2867        v.ClearFlag();
2868        int count = ((IList<int>)v).Count;
2869        IEnumerator<int> enumerator = ((IList<int>)v).GetEnumerator();
2870        ValidateMethod(v.GetFlagState(), TestMethodCalled.IIterable_First);
2871        int index = 0;
2872        foreach (var e in ((IList<int>)v))
2873        {
2874            index = index + 1;
2875            ValidateValue(e, index);
2876        }
2877
2878        ValidateValue(index, 1); //there should only be 1 element there
2879        //IndexOf
2880        v.ClearFlag();
2881        var rez = v.IndexOf(1);
2882        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
2883        ValidateValue(rez, 0); // 1 is on the first line :)
2884        //Insert
2885        v.ClearFlag();
2886        v.Insert(1, 2);
2887        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_InsertAt);
2888        ValidateValue((v as IList<int>)[1], 2);
2889        //IsReadOnly
2890        v.ClearFlag();
2891        bool isReadOnly = ((IList<int>)v).IsReadOnly;
2892        ValidateMethod(v.GetFlagState(), TestMethodCalled.NotSet);
2893        ValidateValue(isReadOnly, false);
2894        //Indexing
2895        v.ClearFlag();
2896        int val = ((int)(v as IList<int>)[0]);
2897        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
2898        ValidateValue(val, 1);
2899        v.ClearFlag();
2900        val = ((IList<int>)v)[1];
2901        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
2902        ValidateValue(val, 2);
2903        //Remove
2904        v.ClearFlag();
2905        ((IList<int>)v).Remove(1);
2906        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
2907        ValidateValue(((IList<int>)v).Count, 1);
2908        //RemoveAt
2909        v.ClearFlag();
2910        v.RemoveAt(0);
2911        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
2912        ValidateValue(((IList<int>)v).Count, 0);
2913        //Clear
2914        v.Add(1);
2915        v.Add(2);
2916        v.ClearFlag();
2917        ((IList<int>)v).Clear();
2918        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Clear);
2919        ValidateValue(((IList<int>)v).Count, 0);
2920        //IVectorView
2921        v.ClearFlag();
2922        count = ((IReadOnlyList<int>)v).Count;
2923        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_get_Size);
2924        var m = v;
2925        //Add
2926        m.ClearFlag();
2927        m.Add(1, 2);
2928        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Insert);
2929        ValidateValue(((IDictionary<int, int>)m).Count, 1);
2930        //ContainsKey
2931        m.ClearFlag();
2932        bool key = ((IDictionary<int, int>)m).ContainsKey(1);
2933        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_HasKey);
2934        //Lookup
2935        m.ClearFlag();
2936        val = ((int)(m as IDictionary<int, int>)[1]);
2937        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Lookup);
2938        ValidateValue(val, 2);
2939        //Keys
2940        m.ClearFlag();
2941        var keys = ((IDictionary<int, int>)m).Keys;
2942        ValidateMethod(m.GetFlagState(), TestMethodCalled.NotSet);
2943        //Values
2944        m.ClearFlag();
2945        var values = ((IDictionary<int, int>)m).Values;
2946        ValidateMethod(m.GetFlagState(), TestMethodCalled.NotSet);
2947        //Lookup
2948        m.ClearFlag();
2949        int outVal;
2950        bool success = ((IDictionary<int, int>)m).TryGetValue(1, out outVal);
2951        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Lookup);
2952        ValidateValue(outVal, 2);
2953        ValidateValue(success, true);
2954        //Add
2955        m.ClearFlag();
2956        m.Add(new KeyValuePair<int, int>(3, 4));
2957        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Insert);
2958        ValidateValue(((IDictionary<int, int>)m).Count, 2);
2959        //Contains
2960        m.ClearFlag();
2961        bool contains = m.Contains(new KeyValuePair<int, int>(3, 4));
2962        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Lookup);
2963        ValidateValue(contains, true);
2964        //non-existant pair
2965        m.ClearFlag();
2966        contains = m.Contains(new KeyValuePair<int, int>(8, 9));
2967        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_HasKey);
2968        ValidateValue(contains, false);
2969        //Remove
2970        m.ClearFlag();
2971        bool remove = ((IDictionary<int, int>)m).Remove(1);
2972        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Remove);
2973        ValidateValue(((IDictionary<int, int>)m).Count, 1);
2974        ValidateValue(remove, true);
2975        //CopyTo
2976        //m.ClearFlag()
2977        //Dim arr As KeyValuePair(Of Integer, Integer)()
2978        //ReDim arr(10)
2979        //m.CopyTo(arr, 1)
2980        //ValidateMethod(m.GetFlagState(), TestMethodCalled.IVector_GetAt)
2981        //ValidateValue(arr[0].Value, 2)
2982        //Count
2983        m.ClearFlag();
2984        count = ((IDictionary<int, int>)m).Count;
2985        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_get_Size);
2986        ValidateValue(count, 1);
2987        //isReadOnly
2988        m.ClearFlag();
2989        isReadOnly = ((IDictionary<int, int>)m).IsReadOnly;
2990        ValidateMethod(m.GetFlagState(), TestMethodCalled.NotSet);
2991        ValidateValue(isReadOnly, false);
2992        //Remove
2993        m.ClearFlag();
2994        var rez2 = m.Remove(new KeyValuePair<int, int>(3, 4));
2995        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Remove);
2996        ValidateValue(rez2, true);
2997        m.ClearFlag();
2998        rez2 = m.Remove(new KeyValuePair<int, int>(2, 3));
2999        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_HasKey);
3000        ValidateValue(rez2, false);
3001        m.Add(1, 2);
3002        m.Add(2, 3);
3003        m.ClearFlag();
3004        ((IDictionary<int, int>)m).Clear();
3005        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Clear);
3006        ValidateValue(((IDictionary<int, int>)m).Count, 0);
3007        //IMapView
3008        m.ClearFlag();
3009        count = ((IReadOnlyDictionary<int, int>)m).Count;
3010        ValidateMethod(m.GetFlagState(), TestMethodCalled.IVector_get_Size);
3011    }
3012
3013    static void TestIVectorStructIVectorViewStructIMapIntStructIMapViewIntStructMembers()
3014    {
3015        var v = new IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct();
3016        var ud = new UserDefinedStruct()
3017        {
3018            Id = 1
3019        }
3020
3021        ;
3022        //Add
3023        v.ClearFlag();
3024        v.Add(ud);
3025        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Append);
3026        //Contains
3027        v.ClearFlag();
3028        bool b = v.Contains(ud);
3029        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
3030        ValidateValue(b, true);
3031        //CopyTo
3032        v.ClearFlag();
3033        UserDefinedStruct[] arr = new UserDefinedStruct[10];
3034
3035        v.CopyTo(arr, 0);
3036        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
3037        ValidateValue(arr[0].Id, ud.Id);
3038        //GetEnumerator
3039        v.ClearFlag();
3040        int count = ((IList<UserDefinedStruct>)v).Count;
3041        IEnumerator<UserDefinedStruct> enumerator = ((IList<UserDefinedStruct>)v).GetEnumerator();
3042        ValidateMethod(v.GetFlagState(), TestMethodCalled.IIterable_First);
3043        enumerator.MoveNext();
3044        ValidateValue((enumerator.Current).Id, 1);
3045        int index = 0;
3046        foreach (var e in ((IList<UserDefinedStruct>)v))
3047        {
3048            index = index + 1;
3049            ValidateValue(e.Id, index);
3050        }
3051
3052        ValidateValue(index, 1); //there should only be 1 element there
3053        //IndexOf
3054        v.ClearFlag();
3055        var rez = v.IndexOf(ud);
3056        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
3057        ValidateValue(rez, 0); // 1 is on the first line :)
3058        //Insert
3059        v.ClearFlag();
3060        v.Insert(1, new UserDefinedStruct()
3061        {
3062            Id = 4
3063        }
3064
3065        );
3066        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_InsertAt);
3067        //IsReadOnly
3068        v.ClearFlag();
3069        bool isReadOnly = ((IList<UserDefinedStruct>)v).IsReadOnly;
3070        ValidateMethod(v.GetFlagState(), TestMethodCalled.NotSet);
3071        ValidateValue(isReadOnly, false);
3072        //Indexing
3073        v.ClearFlag();
3074        var val = (v as IList<UserDefinedStruct>)[0];
3075        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
3076        v.ClearFlag();
3077        val = ((IList<UserDefinedStruct>)v)[1];
3078        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
3079        //Remove
3080        v.ClearFlag();
3081        v.Remove(ud);
3082        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
3083        ValidateValue(((IList<UserDefinedStruct>)v).Count, 1);
3084        //RemoveAt
3085        v.ClearFlag();
3086        v.RemoveAt(0);
3087        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
3088        ValidateValue(((IList<UserDefinedStruct>)v).Count, 0);
3089        //Clear
3090        v.Add(ud);
3091        v.Add(new UserDefinedStruct()
3092        {
3093            Id = 4
3094        }
3095
3096        );
3097        v.ClearFlag();
3098        ((IList<UserDefinedStruct>)v).Clear();
3099        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Clear);
3100        ValidateValue(((IList<UserDefinedStruct>)v).Count, 0);
3101        //IVectorView
3102        v.ClearFlag();
3103        count = ((IReadOnlyList<UserDefinedStruct>)v).Count;
3104        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_get_Size);
3105        var m = v;
3106        ud = new UserDefinedStruct()
3107        {
3108            Id = 10
3109        }
3110
3111        ;
3112        //Add
3113        m.ClearFlag();
3114        m.Add(1, ud);
3115        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Insert);
3116        ValidateValue(((IDictionary<int, UserDefinedStruct>)m).Count, 1);
3117        //ContainsKey
3118        m.ClearFlag();
3119        bool key = ((IDictionary<int, UserDefinedStruct>)m).ContainsKey(1);
3120        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_HasKey);
3121        //Lookup
3122        m.ClearFlag();
3123        val = ((IDictionary<int, UserDefinedStruct>)m)[1];
3124        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Lookup);
3125        //Keys
3126        m.ClearFlag();
3127        var keys = ((IDictionary<int, UserDefinedStruct>)m).Keys;
3128        ValidateMethod(m.GetFlagState(), TestMethodCalled.NotSet);
3129        //Values
3130        m.ClearFlag();
3131        var values = ((IDictionary<int, UserDefinedStruct>)m).Values;
3132        ValidateMethod(m.GetFlagState(), TestMethodCalled.NotSet);
3133        //Lookup
3134        m.ClearFlag();
3135        UserDefinedStruct outVal;
3136        bool success = ((IDictionary<int, UserDefinedStruct>)m).TryGetValue(1, out outVal);
3137        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Lookup);
3138        ValidateValue(success, true);
3139        //Add
3140        m.ClearFlag();
3141        m.Add(new KeyValuePair<int, UserDefinedStruct>(3, new UserDefinedStruct()
3142        {
3143            Id = 4
3144        }
3145
3146        ));
3147        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Insert);
3148        ValidateValue(((IDictionary<int, UserDefinedStruct>)m).Count, 2);
3149        //Contains
3150        m.ClearFlag();
3151        bool contains = m.Contains(new KeyValuePair<int, UserDefinedStruct>(1, ud));
3152        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Lookup);
3153        ValidateValue(contains, true);
3154        //non-existant pair
3155        m.ClearFlag();
3156        contains = m.Contains(new KeyValuePair<int, UserDefinedStruct>(8, new UserDefinedStruct()));
3157        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_HasKey);
3158        ValidateValue(contains, false);
3159        //Remove
3160        m.ClearFlag();
3161        //bool remove = m.Remove(3);
3162        //ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Remove);
3163        //ValidateValue(((IDictionary<int, UserDefinedStruct>)m).Count, 1);
3164        //ValidateValue(remove, true);
3165        //'CopyTo
3166        //m.ClearFlag()
3167        //Dim arr As KeyValuePair(Of Integer, UserDefinedStruct)()
3168        //ReDim arr(10)
3169        //m.CopyTo(arr, 1)
3170        //ValidateMethod(m.GetFlagState(), TestMethodCalled.IVector_GetAt)
3171        //Count
3172        m.ClearFlag();
3173        count = ((IDictionary<int, UserDefinedStruct>)m).Count;
3174        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_get_Size);
3175        ValidateValue(count, 1);
3176        //isReadOnly
3177        m.ClearFlag();
3178        isReadOnly = ((IDictionary<int, UserDefinedStruct>)m).IsReadOnly;
3179        ValidateMethod(m.GetFlagState(), TestMethodCalled.NotSet);
3180        ValidateValue(isReadOnly, false);
3181        //Remove
3182        m.ClearFlag();
3183        m.Remove(new KeyValuePair<int, UserDefinedStruct>(1, ud));
3184        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Remove);
3185        ValidateValue(((IDictionary<int, UserDefinedStruct>)m).Count, 0);
3186        //m.ClearFlag()
3187        //rez = m.Remove(New KeyValuePair(Of Integer, UserDefinedStruct)(3, ud))
3188        //ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_HasKey)
3189        //ValidateValue(rez, False)
3190        //Clear
3191        m.Add(1, ud);
3192        m.Add(2, ud);
3193        m.ClearFlag();
3194        ((IDictionary<int, UserDefinedStruct>)m).Clear();
3195        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Clear);
3196        ValidateValue(((IDictionary<int, UserDefinedStruct>)m).Count, 0);
3197        //ImapView
3198        m.ClearFlag();
3199        count = ((IDictionary<int, UserDefinedStruct>)m).Count;
3200        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_get_Size);
3201    }
3202
3203    static int Main()
3204    {
3205        TestIVectorIntIVectorViewIntIMapIntIntIMapViewIntIntMembers();
3206        TestIVectorStructIVectorViewStructIMapIntStructIMapViewIntStructMembers();
3207
3208        Console.WriteLine(FailedCount);
3209        return FailedCount;
3210    }
3211}";
3212            var verifier = CompileAndVerify(source,
3213                emitOptions: EmitOptions.RefEmitBug,
3214                additionalRefs: LegacyRefs,
3215                verify: false);
3216            verifier.VerifyDiagnostics(
3217                // (3,1): info CS8019: Unnecessary using directive.
3218                // using System.Reflection;
3219                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Reflection;"),
3220                // (4,1): info CS8019: Unnecessary using directive.
3221                // using System.Linq.Expressions;
3222                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq.Expressions;"),
3223                // (6,1): info CS8019: Unnecessary using directive.
3224                // using System.Linq;
3225                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq;"));
3226            verifier.VerifyIL("AllMembers.TestIVectorIntIVectorViewIntIMapIntIntIMapViewIntIntMembers",
3227@"{
3228  // Code size     1497 (0x5d9)
3229  .maxstack  4
3230  .locals init (Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt V_0, //v
3231  bool V_1, //b
3232  int[] V_2, //arr
3233  int V_3, //count
3234  int V_4, //index
3235  int V_5, //rez
3236  bool V_6, //isReadOnly
3237  int V_7, //val
3238  int V_8, //outVal
3239  bool V_9, //success
3240  bool V_10, //contains
3241  bool V_11, //remove
3242  bool V_12, //rez2
3243  System.Collections.Generic.IEnumerator<int> V_13)
3244  IL_0000:  newobj     ""Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt..ctor()""
3245  IL_0005:  stloc.0
3246  IL_0006:  ldloc.0
3247  IL_0007:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3248  IL_000c:  ldloc.0
3249  IL_000d:  ldc.i4.1
3250  IL_000e:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
3251  IL_0013:  ldloc.0
3252  IL_0014:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3253  IL_0019:  ldc.i4.s   9
3254  IL_001b:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3255  IL_0020:  pop
3256  IL_0021:  ldloc.0
3257  IL_0022:  ldc.i4.0
3258  IL_0023:  callvirt   ""int System.Collections.Generic.IList<int>.this[int].get""
3259  IL_0028:  box        ""int""
3260  IL_002d:  ldc.i4.1
3261  IL_002e:  box        ""int""
3262  IL_0033:  call       ""bool AllMembers.ValidateValue(object, object)""
3263  IL_0038:  pop
3264  IL_0039:  ldloc.0
3265  IL_003a:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3266  IL_003f:  ldloc.0
3267  IL_0040:  ldc.i4.1
3268  IL_0041:  callvirt   ""bool System.Collections.Generic.ICollection<int>.Contains(int)""
3269  IL_0046:  stloc.1
3270  IL_0047:  ldloc.0
3271  IL_0048:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3272  IL_004d:  ldc.i4.5
3273  IL_004e:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3274  IL_0053:  pop
3275  IL_0054:  ldloc.1
3276  IL_0055:  box        ""bool""
3277  IL_005a:  ldc.i4.1
3278  IL_005b:  box        ""bool""
3279  IL_0060:  call       ""bool AllMembers.ValidateValue(object, object)""
3280  IL_0065:  pop
3281  IL_0066:  ldloc.0
3282  IL_0067:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3283  IL_006c:  ldc.i4.s   10
3284  IL_006e:  newarr     ""int""
3285  IL_0073:  stloc.2
3286  IL_0074:  ldloc.0
3287  IL_0075:  ldloc.2
3288  IL_0076:  ldc.i4.0
3289  IL_0077:  callvirt   ""void System.Collections.Generic.ICollection<int>.CopyTo(int[], int)""
3290  IL_007c:  ldloc.0
3291  IL_007d:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3292  IL_0082:  ldc.i4.2
3293  IL_0083:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3294  IL_0088:  pop
3295  IL_0089:  ldloc.2
3296  IL_008a:  ldc.i4.0
3297  IL_008b:  ldelem.i4
3298  IL_008c:  box        ""int""
3299  IL_0091:  ldc.i4.1
3300  IL_0092:  box        ""int""
3301  IL_0097:  call       ""bool AllMembers.ValidateValue(object, object)""
3302  IL_009c:  pop
3303  IL_009d:  ldloc.2
3304  IL_009e:  ldc.i4.1
3305  IL_009f:  ldelem.i4
3306  IL_00a0:  box        ""int""
3307  IL_00a5:  ldc.i4.0
3308  IL_00a6:  box        ""int""
3309  IL_00ab:  call       ""bool AllMembers.ValidateValue(object, object)""
3310  IL_00b0:  pop
3311  IL_00b1:  ldloc.0
3312  IL_00b2:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3313  IL_00b7:  ldloc.0
3314  IL_00b8:  callvirt   ""int System.Collections.Generic.ICollection<int>.Count.get""
3315  IL_00bd:  stloc.3
3316  IL_00be:  ldloc.0
3317  IL_00bf:  callvirt   ""System.Collections.Generic.IEnumerator<int> System.Collections.Generic.IEnumerable<int>.GetEnumerator()""
3318  IL_00c4:  pop
3319  IL_00c5:  ldloc.0
3320  IL_00c6:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3321  IL_00cb:  ldc.i4.1
3322  IL_00cc:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3323  IL_00d1:  pop
3324  IL_00d2:  ldc.i4.0
3325  IL_00d3:  stloc.s    V_4
3326  IL_00d5:  ldloc.0
3327  IL_00d6:  callvirt   ""System.Collections.Generic.IEnumerator<int> System.Collections.Generic.IEnumerable<int>.GetEnumerator()""
3328  IL_00db:  stloc.s    V_13
3329  .try
3330{
3331  IL_00dd:  br.s       IL_00fe
3332  IL_00df:  ldloc.s    V_13
3333  IL_00e1:  callvirt   ""int System.Collections.Generic.IEnumerator<int>.Current.get""
3334  IL_00e6:  ldloc.s    V_4
3335  IL_00e8:  ldc.i4.1
3336  IL_00e9:  add
3337  IL_00ea:  stloc.s    V_4
3338  IL_00ec:  box        ""int""
3339  IL_00f1:  ldloc.s    V_4
3340  IL_00f3:  box        ""int""
3341  IL_00f8:  call       ""bool AllMembers.ValidateValue(object, object)""
3342  IL_00fd:  pop
3343  IL_00fe:  ldloc.s    V_13
3344  IL_0100:  callvirt   ""bool System.Collections.IEnumerator.MoveNext()""
3345  IL_0105:  brtrue.s   IL_00df
3346  IL_0107:  leave.s    IL_0115
3347}
3348  finally
3349{
3350  IL_0109:  ldloc.s    V_13
3351  IL_010b:  brfalse.s  IL_0114
3352  IL_010d:  ldloc.s    V_13
3353  IL_010f:  callvirt   ""void System.IDisposable.Dispose()""
3354  IL_0114:  endfinally
3355}
3356  IL_0115:  ldloc.s    V_4
3357  IL_0117:  box        ""int""
3358  IL_011c:  ldc.i4.1
3359  IL_011d:  box        ""int""
3360  IL_0122:  call       ""bool AllMembers.ValidateValue(object, object)""
3361  IL_0127:  pop
3362  IL_0128:  ldloc.0
3363  IL_0129:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3364  IL_012e:  ldloc.0
3365  IL_012f:  ldc.i4.1
3366  IL_0130:  callvirt   ""int System.Collections.Generic.IList<int>.IndexOf(int)""
3367  IL_0135:  stloc.s    V_5
3368  IL_0137:  ldloc.0
3369  IL_0138:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3370  IL_013d:  ldc.i4.5
3371  IL_013e:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3372  IL_0143:  pop
3373  IL_0144:  ldloc.s    V_5
3374  IL_0146:  box        ""int""
3375  IL_014b:  ldc.i4.0
3376  IL_014c:  box        ""int""
3377  IL_0151:  call       ""bool AllMembers.ValidateValue(object, object)""
3378  IL_0156:  pop
3379  IL_0157:  ldloc.0
3380  IL_0158:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3381  IL_015d:  ldloc.0
3382  IL_015e:  ldc.i4.1
3383  IL_015f:  ldc.i4.2
3384  IL_0160:  callvirt   ""void System.Collections.Generic.IList<int>.Insert(int, int)""
3385  IL_0165:  ldloc.0
3386  IL_0166:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3387  IL_016b:  ldc.i4.7
3388  IL_016c:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3389  IL_0171:  pop
3390  IL_0172:  ldloc.0
3391  IL_0173:  ldc.i4.1
3392  IL_0174:  callvirt   ""int System.Collections.Generic.IList<int>.this[int].get""
3393  IL_0179:  box        ""int""
3394  IL_017e:  ldc.i4.2
3395  IL_017f:  box        ""int""
3396  IL_0184:  call       ""bool AllMembers.ValidateValue(object, object)""
3397  IL_0189:  pop
3398  IL_018a:  ldloc.0
3399  IL_018b:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3400  IL_0190:  ldloc.0
3401  IL_0191:  callvirt   ""bool System.Collections.Generic.ICollection<int>.IsReadOnly.get""
3402  IL_0196:  stloc.s    V_6
3403  IL_0198:  ldloc.0
3404  IL_0199:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3405  IL_019e:  ldc.i4.0
3406  IL_019f:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3407  IL_01a4:  pop
3408  IL_01a5:  ldloc.s    V_6
3409  IL_01a7:  box        ""bool""
3410  IL_01ac:  ldc.i4.0
3411  IL_01ad:  box        ""bool""
3412  IL_01b2:  call       ""bool AllMembers.ValidateValue(object, object)""
3413  IL_01b7:  pop
3414  IL_01b8:  ldloc.0
3415  IL_01b9:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3416  IL_01be:  ldloc.0
3417  IL_01bf:  ldc.i4.0
3418  IL_01c0:  callvirt   ""int System.Collections.Generic.IList<int>.this[int].get""
3419  IL_01c5:  stloc.s    V_7
3420  IL_01c7:  ldloc.0
3421  IL_01c8:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3422  IL_01cd:  ldc.i4.2
3423  IL_01ce:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3424  IL_01d3:  pop
3425  IL_01d4:  ldloc.s    V_7
3426  IL_01d6:  box        ""int""
3427  IL_01db:  ldc.i4.1
3428  IL_01dc:  box        ""int""
3429  IL_01e1:  call       ""bool AllMembers.ValidateValue(object, object)""
3430  IL_01e6:  pop
3431  IL_01e7:  ldloc.0
3432  IL_01e8:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3433  IL_01ed:  ldloc.0
3434  IL_01ee:  ldc.i4.1
3435  IL_01ef:  callvirt   ""int System.Collections.Generic.IList<int>.this[int].get""
3436  IL_01f4:  stloc.s    V_7
3437  IL_01f6:  ldloc.0
3438  IL_01f7:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3439  IL_01fc:  ldc.i4.2
3440  IL_01fd:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3441  IL_0202:  pop
3442  IL_0203:  ldloc.s    V_7
3443  IL_0205:  box        ""int""
3444  IL_020a:  ldc.i4.2
3445  IL_020b:  box        ""int""
3446  IL_0210:  call       ""bool AllMembers.ValidateValue(object, object)""
3447  IL_0215:  pop
3448  IL_0216:  ldloc.0
3449  IL_0217:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3450  IL_021c:  ldloc.0
3451  IL_021d:  ldc.i4.1
3452  IL_021e:  callvirt   ""bool System.Collections.Generic.ICollection<int>.Remove(int)""
3453  IL_0223:  pop
3454  IL_0224:  ldloc.0
3455  IL_0225:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3456  IL_022a:  ldc.i4.8
3457  IL_022b:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3458  IL_0230:  pop
3459  IL_0231:  ldloc.0
3460  IL_0232:  callvirt   ""int System.Collections.Generic.ICollection<int>.Count.get""
3461  IL_0237:  box        ""int""
3462  IL_023c:  ldc.i4.1
3463  IL_023d:  box        ""int""
3464  IL_0242:  call       ""bool AllMembers.ValidateValue(object, object)""
3465  IL_0247:  pop
3466  IL_0248:  ldloc.0
3467  IL_0249:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3468  IL_024e:  ldloc.0
3469  IL_024f:  ldc.i4.0
3470  IL_0250:  callvirt   ""void System.Collections.Generic.IList<int>.RemoveAt(int)""
3471  IL_0255:  ldloc.0
3472  IL_0256:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3473  IL_025b:  ldc.i4.8
3474  IL_025c:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3475  IL_0261:  pop
3476  IL_0262:  ldloc.0
3477  IL_0263:  callvirt   ""int System.Collections.Generic.ICollection<int>.Count.get""
3478  IL_0268:  box        ""int""
3479  IL_026d:  ldc.i4.0
3480  IL_026e:  box        ""int""
3481  IL_0273:  call       ""bool AllMembers.ValidateValue(object, object)""
3482  IL_0278:  pop
3483  IL_0279:  ldloc.0
3484  IL_027a:  ldc.i4.1
3485  IL_027b:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
3486  IL_0280:  ldloc.0
3487  IL_0281:  ldc.i4.2
3488  IL_0282:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
3489  IL_0287:  ldloc.0
3490  IL_0288:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3491  IL_028d:  ldloc.0
3492  IL_028e:  callvirt   ""void System.Collections.Generic.ICollection<int>.Clear()""
3493  IL_0293:  ldloc.0
3494  IL_0294:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3495  IL_0299:  ldc.i4.s   11
3496  IL_029b:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3497  IL_02a0:  pop
3498  IL_02a1:  ldloc.0
3499  IL_02a2:  callvirt   ""int System.Collections.Generic.ICollection<int>.Count.get""
3500  IL_02a7:  box        ""int""
3501  IL_02ac:  ldc.i4.0
3502  IL_02ad:  box        ""int""
3503  IL_02b2:  call       ""bool AllMembers.ValidateValue(object, object)""
3504  IL_02b7:  pop
3505  IL_02b8:  ldloc.0
3506  IL_02b9:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3507  IL_02be:  ldloc.0
3508  IL_02bf:  callvirt   ""int System.Collections.Generic.IReadOnlyCollection<int>.Count.get""
3509  IL_02c4:  stloc.3
3510  IL_02c5:  ldloc.0
3511  IL_02c6:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3512  IL_02cb:  ldc.i4.3
3513  IL_02cc:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3514  IL_02d1:  pop
3515  IL_02d2:  ldloc.0
3516  IL_02d3:  dup
3517  IL_02d4:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3518  IL_02d9:  dup
3519  IL_02da:  ldc.i4.1
3520  IL_02db:  ldc.i4.2
3521  IL_02dc:  callvirt   ""void System.Collections.Generic.IDictionary<int, int>.Add(int, int)""
3522  IL_02e1:  dup
3523  IL_02e2:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3524  IL_02e7:  ldc.i4.s   21
3525  IL_02e9:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3526  IL_02ee:  pop
3527  IL_02ef:  dup
3528  IL_02f0:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Count.get""
3529  IL_02f5:  box        ""int""
3530  IL_02fa:  ldc.i4.1
3531  IL_02fb:  box        ""int""
3532  IL_0300:  call       ""bool AllMembers.ValidateValue(object, object)""
3533  IL_0305:  pop
3534  IL_0306:  dup
3535  IL_0307:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3536  IL_030c:  dup
3537  IL_030d:  ldc.i4.1
3538  IL_030e:  callvirt   ""bool System.Collections.Generic.IDictionary<int, int>.ContainsKey(int)""
3539  IL_0313:  pop
3540  IL_0314:  dup
3541  IL_0315:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3542  IL_031a:  ldc.i4.s   19
3543  IL_031c:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3544  IL_0321:  pop
3545  IL_0322:  dup
3546  IL_0323:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3547  IL_0328:  dup
3548  IL_0329:  ldc.i4.1
3549  IL_032a:  callvirt   ""int System.Collections.Generic.IDictionary<int, int>.this[int].get""
3550  IL_032f:  stloc.s    V_7
3551  IL_0331:  dup
3552  IL_0332:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3553  IL_0337:  ldc.i4.s   17
3554  IL_0339:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3555  IL_033e:  pop
3556  IL_033f:  ldloc.s    V_7
3557  IL_0341:  box        ""int""
3558  IL_0346:  ldc.i4.2
3559  IL_0347:  box        ""int""
3560  IL_034c:  call       ""bool AllMembers.ValidateValue(object, object)""
3561  IL_0351:  pop
3562  IL_0352:  dup
3563  IL_0353:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3564  IL_0358:  dup
3565  IL_0359:  callvirt   ""System.Collections.Generic.ICollection<int> System.Collections.Generic.IDictionary<int, int>.Keys.get""
3566  IL_035e:  pop
3567  IL_035f:  dup
3568  IL_0360:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3569  IL_0365:  ldc.i4.0
3570  IL_0366:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3571  IL_036b:  pop
3572  IL_036c:  dup
3573  IL_036d:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3574  IL_0372:  dup
3575  IL_0373:  callvirt   ""System.Collections.Generic.ICollection<int> System.Collections.Generic.IDictionary<int, int>.Values.get""
3576  IL_0378:  pop
3577  IL_0379:  dup
3578  IL_037a:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3579  IL_037f:  ldc.i4.0
3580  IL_0380:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3581  IL_0385:  pop
3582  IL_0386:  dup
3583  IL_0387:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3584  IL_038c:  dup
3585  IL_038d:  ldc.i4.1
3586  IL_038e:  ldloca.s   V_8
3587  IL_0390:  callvirt   ""bool System.Collections.Generic.IDictionary<int, int>.TryGetValue(int, out int)""
3588  IL_0395:  stloc.s    V_9
3589  IL_0397:  dup
3590  IL_0398:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3591  IL_039d:  ldc.i4.s   17
3592  IL_039f:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3593  IL_03a4:  pop
3594  IL_03a5:  ldloc.s    V_8
3595  IL_03a7:  box        ""int""
3596  IL_03ac:  ldc.i4.2
3597  IL_03ad:  box        ""int""
3598  IL_03b2:  call       ""bool AllMembers.ValidateValue(object, object)""
3599  IL_03b7:  pop
3600  IL_03b8:  ldloc.s    V_9
3601  IL_03ba:  box        ""bool""
3602  IL_03bf:  ldc.i4.1
3603  IL_03c0:  box        ""bool""
3604  IL_03c5:  call       ""bool AllMembers.ValidateValue(object, object)""
3605  IL_03ca:  pop
3606  IL_03cb:  dup
3607  IL_03cc:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3608  IL_03d1:  dup
3609  IL_03d2:  ldc.i4.3
3610  IL_03d3:  ldc.i4.4
3611  IL_03d4:  newobj     ""System.Collections.Generic.KeyValuePair<int, int>..ctor(int, int)""
3612  IL_03d9:  callvirt   ""void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Add(System.Collections.Generic.KeyValuePair<int, int>)""
3613  IL_03de:  dup
3614  IL_03df:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3615  IL_03e4:  ldc.i4.s   21
3616  IL_03e6:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3617  IL_03eb:  pop
3618  IL_03ec:  dup
3619  IL_03ed:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Count.get""
3620  IL_03f2:  box        ""int""
3621  IL_03f7:  ldc.i4.2
3622  IL_03f8:  box        ""int""
3623  IL_03fd:  call       ""bool AllMembers.ValidateValue(object, object)""
3624  IL_0402:  pop
3625  IL_0403:  dup
3626  IL_0404:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3627  IL_0409:  dup
3628  IL_040a:  ldc.i4.3
3629  IL_040b:  ldc.i4.4
3630  IL_040c:  newobj     ""System.Collections.Generic.KeyValuePair<int, int>..ctor(int, int)""
3631  IL_0411:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Contains(System.Collections.Generic.KeyValuePair<int, int>)""
3632  IL_0416:  stloc.s    V_10
3633  IL_0418:  dup
3634  IL_0419:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3635  IL_041e:  ldc.i4.s   17
3636  IL_0420:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3637  IL_0425:  pop
3638  IL_0426:  ldloc.s    V_10
3639  IL_0428:  box        ""bool""
3640  IL_042d:  ldc.i4.1
3641  IL_042e:  box        ""bool""
3642  IL_0433:  call       ""bool AllMembers.ValidateValue(object, object)""
3643  IL_0438:  pop
3644  IL_0439:  dup
3645  IL_043a:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3646  IL_043f:  dup
3647  IL_0440:  ldc.i4.8
3648  IL_0441:  ldc.i4.s   9
3649  IL_0443:  newobj     ""System.Collections.Generic.KeyValuePair<int, int>..ctor(int, int)""
3650  IL_0448:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Contains(System.Collections.Generic.KeyValuePair<int, int>)""
3651  IL_044d:  stloc.s    V_10
3652  IL_044f:  dup
3653  IL_0450:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3654  IL_0455:  ldc.i4.s   19
3655  IL_0457:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3656  IL_045c:  pop
3657  IL_045d:  ldloc.s    V_10
3658  IL_045f:  box        ""bool""
3659  IL_0464:  ldc.i4.0
3660  IL_0465:  box        ""bool""
3661  IL_046a:  call       ""bool AllMembers.ValidateValue(object, object)""
3662  IL_046f:  pop
3663  IL_0470:  dup
3664  IL_0471:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3665  IL_0476:  dup
3666  IL_0477:  ldc.i4.1
3667  IL_0478:  callvirt   ""bool System.Collections.Generic.IDictionary<int, int>.Remove(int)""
3668  IL_047d:  stloc.s    V_11
3669  IL_047f:  dup
3670  IL_0480:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3671  IL_0485:  ldc.i4.s   22
3672  IL_0487:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3673  IL_048c:  pop
3674  IL_048d:  dup
3675  IL_048e:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Count.get""
3676  IL_0493:  box        ""int""
3677  IL_0498:  ldc.i4.1
3678  IL_0499:  box        ""int""
3679  IL_049e:  call       ""bool AllMembers.ValidateValue(object, object)""
3680  IL_04a3:  pop
3681  IL_04a4:  ldloc.s    V_11
3682  IL_04a6:  box        ""bool""
3683  IL_04ab:  ldc.i4.1
3684  IL_04ac:  box        ""bool""
3685  IL_04b1:  call       ""bool AllMembers.ValidateValue(object, object)""
3686  IL_04b6:  pop
3687  IL_04b7:  dup
3688  IL_04b8:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3689  IL_04bd:  dup
3690  IL_04be:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Count.get""
3691  IL_04c3:  stloc.3
3692  IL_04c4:  dup
3693  IL_04c5:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3694  IL_04ca:  ldc.i4.s   18
3695  IL_04cc:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3696  IL_04d1:  pop
3697  IL_04d2:  ldloc.3
3698  IL_04d3:  box        ""int""
3699  IL_04d8:  ldc.i4.1
3700  IL_04d9:  box        ""int""
3701  IL_04de:  call       ""bool AllMembers.ValidateValue(object, object)""
3702  IL_04e3:  pop
3703  IL_04e4:  dup
3704  IL_04e5:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3705  IL_04ea:  dup
3706  IL_04eb:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.IsReadOnly.get""
3707  IL_04f0:  stloc.s    V_6
3708  IL_04f2:  dup
3709  IL_04f3:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3710  IL_04f8:  ldc.i4.0
3711  IL_04f9:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3712  IL_04fe:  pop
3713  IL_04ff:  ldloc.s    V_6
3714  IL_0501:  box        ""bool""
3715  IL_0506:  ldc.i4.0
3716  IL_0507:  box        ""bool""
3717  IL_050c:  call       ""bool AllMembers.ValidateValue(object, object)""
3718  IL_0511:  pop
3719  IL_0512:  dup
3720  IL_0513:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3721  IL_0518:  dup
3722  IL_0519:  ldc.i4.3
3723  IL_051a:  ldc.i4.4
3724  IL_051b:  newobj     ""System.Collections.Generic.KeyValuePair<int, int>..ctor(int, int)""
3725  IL_0520:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Remove(System.Collections.Generic.KeyValuePair<int, int>)""
3726  IL_0525:  stloc.s    V_12
3727  IL_0527:  dup
3728  IL_0528:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3729  IL_052d:  ldc.i4.s   22
3730  IL_052f:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3731  IL_0534:  pop
3732  IL_0535:  ldloc.s    V_12
3733  IL_0537:  box        ""bool""
3734  IL_053c:  ldc.i4.1
3735  IL_053d:  box        ""bool""
3736  IL_0542:  call       ""bool AllMembers.ValidateValue(object, object)""
3737  IL_0547:  pop
3738  IL_0548:  dup
3739  IL_0549:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3740  IL_054e:  dup
3741  IL_054f:  ldc.i4.2
3742  IL_0550:  ldc.i4.3
3743  IL_0551:  newobj     ""System.Collections.Generic.KeyValuePair<int, int>..ctor(int, int)""
3744  IL_0556:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Remove(System.Collections.Generic.KeyValuePair<int, int>)""
3745  IL_055b:  stloc.s    V_12
3746  IL_055d:  dup
3747  IL_055e:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3748  IL_0563:  ldc.i4.s   19
3749  IL_0565:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3750  IL_056a:  pop
3751  IL_056b:  ldloc.s    V_12
3752  IL_056d:  box        ""bool""
3753  IL_0572:  ldc.i4.0
3754  IL_0573:  box        ""bool""
3755  IL_0578:  call       ""bool AllMembers.ValidateValue(object, object)""
3756  IL_057d:  pop
3757  IL_057e:  dup
3758  IL_057f:  ldc.i4.1
3759  IL_0580:  ldc.i4.2
3760  IL_0581:  callvirt   ""void System.Collections.Generic.IDictionary<int, int>.Add(int, int)""
3761  IL_0586:  dup
3762  IL_0587:  ldc.i4.2
3763  IL_0588:  ldc.i4.3
3764  IL_0589:  callvirt   ""void System.Collections.Generic.IDictionary<int, int>.Add(int, int)""
3765  IL_058e:  dup
3766  IL_058f:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3767  IL_0594:  dup
3768  IL_0595:  callvirt   ""void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Clear()""
3769  IL_059a:  dup
3770  IL_059b:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3771  IL_05a0:  ldc.i4.s   23
3772  IL_05a2:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3773  IL_05a7:  pop
3774  IL_05a8:  dup
3775  IL_05a9:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Count.get""
3776  IL_05ae:  box        ""int""
3777  IL_05b3:  ldc.i4.0
3778  IL_05b4:  box        ""int""
3779  IL_05b9:  call       ""bool AllMembers.ValidateValue(object, object)""
3780  IL_05be:  pop
3781  IL_05bf:  dup
3782  IL_05c0:  callvirt   ""void Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.ClearFlag()""
3783  IL_05c5:  dup
3784  IL_05c6:  callvirt   ""int System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<int, int>>.Count.get""
3785  IL_05cb:  stloc.3
3786  IL_05cc:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorIntIVectorViewIntIMapIntIntIMapViewIntInt.GetFlagState()""
3787  IL_05d1:  ldc.i4.3
3788  IL_05d2:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3789  IL_05d7:  pop
3790  IL_05d8:  ret
3791}");
3792            verifier.VerifyIL("AllMembers.TestIVectorStructIVectorViewStructIMapIntStructIMapViewIntStructMembers",
3793@"{
3794  // Code size     1395 (0x573)
3795  .maxstack  5
3796  .locals init (Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct V_0, //v
3797  Windows.Languages.WinRTTest.UserDefinedStruct V_1, //ud
3798  bool V_2, //b
3799  Windows.Languages.WinRTTest.UserDefinedStruct[] V_3, //arr
3800  int V_4, //count
3801  System.Collections.Generic.IEnumerator<Windows.Languages.WinRTTest.UserDefinedStruct> V_5, //enumerator
3802  int V_6, //index
3803  int V_7, //rez
3804  bool V_8, //isReadOnly
3805  Windows.Languages.WinRTTest.UserDefinedStruct V_9, //outVal
3806  bool V_10, //success
3807  bool V_11, //contains
3808  Windows.Languages.WinRTTest.UserDefinedStruct V_12,
3809  System.Collections.Generic.IEnumerator<Windows.Languages.WinRTTest.UserDefinedStruct> V_13)
3810  IL_0000:  newobj     ""Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct..ctor()""
3811  IL_0005:  stloc.0
3812  IL_0006:  ldloca.s   V_12
3813  IL_0008:  initobj    ""Windows.Languages.WinRTTest.UserDefinedStruct""
3814  IL_000e:  ldloca.s   V_12
3815  IL_0010:  ldc.i4.1
3816  IL_0011:  stfld      ""uint Windows.Languages.WinRTTest.UserDefinedStruct.Id""
3817  IL_0016:  ldloc.s    V_12
3818  IL_0018:  stloc.1
3819  IL_0019:  ldloc.0
3820  IL_001a:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
3821  IL_001f:  ldloc.0
3822  IL_0020:  ldloc.1
3823  IL_0021:  callvirt   ""void System.Collections.Generic.ICollection<Windows.Languages.WinRTTest.UserDefinedStruct>.Add(Windows.Languages.WinRTTest.UserDefinedStruct)""
3824  IL_0026:  ldloc.0
3825  IL_0027:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
3826  IL_002c:  ldc.i4.s   9
3827  IL_002e:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3828  IL_0033:  pop
3829  IL_0034:  ldloc.0
3830  IL_0035:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
3831  IL_003a:  ldloc.0
3832  IL_003b:  ldloc.1
3833  IL_003c:  callvirt   ""bool System.Collections.Generic.ICollection<Windows.Languages.WinRTTest.UserDefinedStruct>.Contains(Windows.Languages.WinRTTest.UserDefinedStruct)""
3834  IL_0041:  stloc.2
3835  IL_0042:  ldloc.0
3836  IL_0043:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
3837  IL_0048:  ldc.i4.5
3838  IL_0049:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3839  IL_004e:  pop
3840  IL_004f:  ldloc.2
3841  IL_0050:  box        ""bool""
3842  IL_0055:  ldc.i4.1
3843  IL_0056:  box        ""bool""
3844  IL_005b:  call       ""bool AllMembers.ValidateValue(object, object)""
3845  IL_0060:  pop
3846  IL_0061:  ldloc.0
3847  IL_0062:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
3848  IL_0067:  ldc.i4.s   10
3849  IL_0069:  newarr     ""Windows.Languages.WinRTTest.UserDefinedStruct""
3850  IL_006e:  stloc.3
3851  IL_006f:  ldloc.0
3852  IL_0070:  ldloc.3
3853  IL_0071:  ldc.i4.0
3854  IL_0072:  callvirt   ""void System.Collections.Generic.ICollection<Windows.Languages.WinRTTest.UserDefinedStruct>.CopyTo(Windows.Languages.WinRTTest.UserDefinedStruct[], int)""
3855  IL_0077:  ldloc.0
3856  IL_0078:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
3857  IL_007d:  ldc.i4.2
3858  IL_007e:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3859  IL_0083:  pop
3860  IL_0084:  ldloc.3
3861  IL_0085:  ldc.i4.0
3862  IL_0086:  ldelema    ""Windows.Languages.WinRTTest.UserDefinedStruct""
3863  IL_008b:  ldfld      ""uint Windows.Languages.WinRTTest.UserDefinedStruct.Id""
3864  IL_0090:  box        ""uint""
3865  IL_0095:  ldloc.1
3866  IL_0096:  ldfld      ""uint Windows.Languages.WinRTTest.UserDefinedStruct.Id""
3867  IL_009b:  box        ""uint""
3868  IL_00a0:  call       ""bool AllMembers.ValidateValue(object, object)""
3869  IL_00a5:  pop
3870  IL_00a6:  ldloc.0
3871  IL_00a7:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
3872  IL_00ac:  ldloc.0
3873  IL_00ad:  callvirt   ""int System.Collections.Generic.ICollection<Windows.Languages.WinRTTest.UserDefinedStruct>.Count.get""
3874  IL_00b2:  stloc.s    V_4
3875  IL_00b4:  ldloc.0
3876  IL_00b5:  callvirt   ""System.Collections.Generic.IEnumerator<Windows.Languages.WinRTTest.UserDefinedStruct> System.Collections.Generic.IEnumerable<Windows.Languages.WinRTTest.UserDefinedStruct>.GetEnumerator()""
3877  IL_00ba:  stloc.s    V_5
3878  IL_00bc:  ldloc.0
3879  IL_00bd:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
3880  IL_00c2:  ldc.i4.1
3881  IL_00c3:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3882  IL_00c8:  pop
3883  IL_00c9:  ldloc.s    V_5
3884  IL_00cb:  callvirt   ""bool System.Collections.IEnumerator.MoveNext()""
3885  IL_00d0:  pop
3886  IL_00d1:  ldloc.s    V_5
3887  IL_00d3:  callvirt   ""Windows.Languages.WinRTTest.UserDefinedStruct System.Collections.Generic.IEnumerator<Windows.Languages.WinRTTest.UserDefinedStruct>.Current.get""
3888  IL_00d8:  ldfld      ""uint Windows.Languages.WinRTTest.UserDefinedStruct.Id""
3889  IL_00dd:  box        ""uint""
3890  IL_00e2:  ldc.i4.1
3891  IL_00e3:  box        ""int""
3892  IL_00e8:  call       ""bool AllMembers.ValidateValue(object, object)""
3893  IL_00ed:  pop
3894  IL_00ee:  ldc.i4.0
3895  IL_00ef:  stloc.s    V_6
3896  IL_00f1:  ldloc.0
3897  IL_00f2:  callvirt   ""System.Collections.Generic.IEnumerator<Windows.Languages.WinRTTest.UserDefinedStruct> System.Collections.Generic.IEnumerable<Windows.Languages.WinRTTest.UserDefinedStruct>.GetEnumerator()""
3898  IL_00f7:  stloc.s    V_13
3899  .try
3900{
3901  IL_00f9:  br.s       IL_011f
3902  IL_00fb:  ldloc.s    V_13
3903  IL_00fd:  callvirt   ""Windows.Languages.WinRTTest.UserDefinedStruct System.Collections.Generic.IEnumerator<Windows.Languages.WinRTTest.UserDefinedStruct>.Current.get""
3904  IL_0102:  ldloc.s    V_6
3905  IL_0104:  ldc.i4.1
3906  IL_0105:  add
3907  IL_0106:  stloc.s    V_6
3908  IL_0108:  ldfld      ""uint Windows.Languages.WinRTTest.UserDefinedStruct.Id""
3909  IL_010d:  box        ""uint""
3910  IL_0112:  ldloc.s    V_6
3911  IL_0114:  box        ""int""
3912  IL_0119:  call       ""bool AllMembers.ValidateValue(object, object)""
3913  IL_011e:  pop
3914  IL_011f:  ldloc.s    V_13
3915  IL_0121:  callvirt   ""bool System.Collections.IEnumerator.MoveNext()""
3916  IL_0126:  brtrue.s   IL_00fb
3917  IL_0128:  leave.s    IL_0136
3918}
3919  finally
3920{
3921  IL_012a:  ldloc.s    V_13
3922  IL_012c:  brfalse.s  IL_0135
3923  IL_012e:  ldloc.s    V_13
3924  IL_0130:  callvirt   ""void System.IDisposable.Dispose()""
3925  IL_0135:  endfinally
3926}
3927  IL_0136:  ldloc.s    V_6
3928  IL_0138:  box        ""int""
3929  IL_013d:  ldc.i4.1
3930  IL_013e:  box        ""int""
3931  IL_0143:  call       ""bool AllMembers.ValidateValue(object, object)""
3932  IL_0148:  pop
3933  IL_0149:  ldloc.0
3934  IL_014a:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
3935  IL_014f:  ldloc.0
3936  IL_0150:  ldloc.1
3937  IL_0151:  callvirt   ""int System.Collections.Generic.IList<Windows.Languages.WinRTTest.UserDefinedStruct>.IndexOf(Windows.Languages.WinRTTest.UserDefinedStruct)""
3938  IL_0156:  stloc.s    V_7
3939  IL_0158:  ldloc.0
3940  IL_0159:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
3941  IL_015e:  ldc.i4.5
3942  IL_015f:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3943  IL_0164:  pop
3944  IL_0165:  ldloc.s    V_7
3945  IL_0167:  box        ""int""
3946  IL_016c:  ldc.i4.0
3947  IL_016d:  box        ""int""
3948  IL_0172:  call       ""bool AllMembers.ValidateValue(object, object)""
3949  IL_0177:  pop
3950  IL_0178:  ldloc.0
3951  IL_0179:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
3952  IL_017e:  ldloc.0
3953  IL_017f:  ldc.i4.1
3954  IL_0180:  ldloca.s   V_12
3955  IL_0182:  initobj    ""Windows.Languages.WinRTTest.UserDefinedStruct""
3956  IL_0188:  ldloca.s   V_12
3957  IL_018a:  ldc.i4.4
3958  IL_018b:  stfld      ""uint Windows.Languages.WinRTTest.UserDefinedStruct.Id""
3959  IL_0190:  ldloc.s    V_12
3960  IL_0192:  callvirt   ""void System.Collections.Generic.IList<Windows.Languages.WinRTTest.UserDefinedStruct>.Insert(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
3961  IL_0197:  ldloc.0
3962  IL_0198:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
3963  IL_019d:  ldc.i4.7
3964  IL_019e:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3965  IL_01a3:  pop
3966  IL_01a4:  ldloc.0
3967  IL_01a5:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
3968  IL_01aa:  ldloc.0
3969  IL_01ab:  callvirt   ""bool System.Collections.Generic.ICollection<Windows.Languages.WinRTTest.UserDefinedStruct>.IsReadOnly.get""
3970  IL_01b0:  stloc.s    V_8
3971  IL_01b2:  ldloc.0
3972  IL_01b3:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
3973  IL_01b8:  ldc.i4.0
3974  IL_01b9:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3975  IL_01be:  pop
3976  IL_01bf:  ldloc.s    V_8
3977  IL_01c1:  box        ""bool""
3978  IL_01c6:  ldc.i4.0
3979  IL_01c7:  box        ""bool""
3980  IL_01cc:  call       ""bool AllMembers.ValidateValue(object, object)""
3981  IL_01d1:  pop
3982  IL_01d2:  ldloc.0
3983  IL_01d3:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
3984  IL_01d8:  ldloc.0
3985  IL_01d9:  ldc.i4.0
3986  IL_01da:  callvirt   ""Windows.Languages.WinRTTest.UserDefinedStruct System.Collections.Generic.IList<Windows.Languages.WinRTTest.UserDefinedStruct>.this[int].get""
3987  IL_01df:  pop
3988  IL_01e0:  ldloc.0
3989  IL_01e1:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
3990  IL_01e6:  ldc.i4.2
3991  IL_01e7:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
3992  IL_01ec:  pop
3993  IL_01ed:  ldloc.0
3994  IL_01ee:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
3995  IL_01f3:  ldloc.0
3996  IL_01f4:  ldc.i4.1
3997  IL_01f5:  callvirt   ""Windows.Languages.WinRTTest.UserDefinedStruct System.Collections.Generic.IList<Windows.Languages.WinRTTest.UserDefinedStruct>.this[int].get""
3998  IL_01fa:  pop
3999  IL_01fb:  ldloc.0
4000  IL_01fc:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
4001  IL_0201:  ldc.i4.2
4002  IL_0202:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4003  IL_0207:  pop
4004  IL_0208:  ldloc.0
4005  IL_0209:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
4006  IL_020e:  ldloc.0
4007  IL_020f:  ldloc.1
4008  IL_0210:  callvirt   ""bool System.Collections.Generic.ICollection<Windows.Languages.WinRTTest.UserDefinedStruct>.Remove(Windows.Languages.WinRTTest.UserDefinedStruct)""
4009  IL_0215:  pop
4010  IL_0216:  ldloc.0
4011  IL_0217:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
4012  IL_021c:  ldc.i4.8
4013  IL_021d:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4014  IL_0222:  pop
4015  IL_0223:  ldloc.0
4016  IL_0224:  callvirt   ""int System.Collections.Generic.ICollection<Windows.Languages.WinRTTest.UserDefinedStruct>.Count.get""
4017  IL_0229:  box        ""int""
4018  IL_022e:  ldc.i4.1
4019  IL_022f:  box        ""int""
4020  IL_0234:  call       ""bool AllMembers.ValidateValue(object, object)""
4021  IL_0239:  pop
4022  IL_023a:  ldloc.0
4023  IL_023b:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
4024  IL_0240:  ldloc.0
4025  IL_0241:  ldc.i4.0
4026  IL_0242:  callvirt   ""void System.Collections.Generic.IList<Windows.Languages.WinRTTest.UserDefinedStruct>.RemoveAt(int)""
4027  IL_0247:  ldloc.0
4028  IL_0248:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
4029  IL_024d:  ldc.i4.8
4030  IL_024e:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4031  IL_0253:  pop
4032  IL_0254:  ldloc.0
4033  IL_0255:  callvirt   ""int System.Collections.Generic.ICollection<Windows.Languages.WinRTTest.UserDefinedStruct>.Count.get""
4034  IL_025a:  box        ""int""
4035  IL_025f:  ldc.i4.0
4036  IL_0260:  box        ""int""
4037  IL_0265:  call       ""bool AllMembers.ValidateValue(object, object)""
4038  IL_026a:  pop
4039  IL_026b:  ldloc.0
4040  IL_026c:  ldloc.1
4041  IL_026d:  callvirt   ""void System.Collections.Generic.ICollection<Windows.Languages.WinRTTest.UserDefinedStruct>.Add(Windows.Languages.WinRTTest.UserDefinedStruct)""
4042  IL_0272:  ldloc.0
4043  IL_0273:  ldloca.s   V_12
4044  IL_0275:  initobj    ""Windows.Languages.WinRTTest.UserDefinedStruct""
4045  IL_027b:  ldloca.s   V_12
4046  IL_027d:  ldc.i4.4
4047  IL_027e:  stfld      ""uint Windows.Languages.WinRTTest.UserDefinedStruct.Id""
4048  IL_0283:  ldloc.s    V_12
4049  IL_0285:  callvirt   ""void System.Collections.Generic.ICollection<Windows.Languages.WinRTTest.UserDefinedStruct>.Add(Windows.Languages.WinRTTest.UserDefinedStruct)""
4050  IL_028a:  ldloc.0
4051  IL_028b:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
4052  IL_0290:  ldloc.0
4053  IL_0291:  callvirt   ""void System.Collections.Generic.ICollection<Windows.Languages.WinRTTest.UserDefinedStruct>.Clear()""
4054  IL_0296:  ldloc.0
4055  IL_0297:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
4056  IL_029c:  ldc.i4.s   11
4057  IL_029e:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4058  IL_02a3:  pop
4059  IL_02a4:  ldloc.0
4060  IL_02a5:  callvirt   ""int System.Collections.Generic.ICollection<Windows.Languages.WinRTTest.UserDefinedStruct>.Count.get""
4061  IL_02aa:  box        ""int""
4062  IL_02af:  ldc.i4.0
4063  IL_02b0:  box        ""int""
4064  IL_02b5:  call       ""bool AllMembers.ValidateValue(object, object)""
4065  IL_02ba:  pop
4066  IL_02bb:  ldloc.0
4067  IL_02bc:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
4068  IL_02c1:  ldloc.0
4069  IL_02c2:  callvirt   ""int System.Collections.Generic.IReadOnlyCollection<Windows.Languages.WinRTTest.UserDefinedStruct>.Count.get""
4070  IL_02c7:  stloc.s    V_4
4071  IL_02c9:  ldloc.0
4072  IL_02ca:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
4073  IL_02cf:  ldc.i4.3
4074  IL_02d0:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4075  IL_02d5:  pop
4076  IL_02d6:  ldloc.0
4077  IL_02d7:  ldloca.s   V_12
4078  IL_02d9:  initobj    ""Windows.Languages.WinRTTest.UserDefinedStruct""
4079  IL_02df:  ldloca.s   V_12
4080  IL_02e1:  ldc.i4.s   10
4081  IL_02e3:  stfld      ""uint Windows.Languages.WinRTTest.UserDefinedStruct.Id""
4082  IL_02e8:  ldloc.s    V_12
4083  IL_02ea:  stloc.1
4084  IL_02eb:  dup
4085  IL_02ec:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
4086  IL_02f1:  dup
4087  IL_02f2:  ldc.i4.1
4088  IL_02f3:  ldloc.1
4089  IL_02f4:  callvirt   ""void System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.Add(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
4090  IL_02f9:  dup
4091  IL_02fa:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
4092  IL_02ff:  ldc.i4.s   21
4093  IL_0301:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4094  IL_0306:  pop
4095  IL_0307:  dup
4096  IL_0308:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Count.get""
4097  IL_030d:  box        ""int""
4098  IL_0312:  ldc.i4.1
4099  IL_0313:  box        ""int""
4100  IL_0318:  call       ""bool AllMembers.ValidateValue(object, object)""
4101  IL_031d:  pop
4102  IL_031e:  dup
4103  IL_031f:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
4104  IL_0324:  dup
4105  IL_0325:  ldc.i4.1
4106  IL_0326:  callvirt   ""bool System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.ContainsKey(int)""
4107  IL_032b:  pop
4108  IL_032c:  dup
4109  IL_032d:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
4110  IL_0332:  ldc.i4.s   19
4111  IL_0334:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4112  IL_0339:  pop
4113  IL_033a:  dup
4114  IL_033b:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
4115  IL_0340:  dup
4116  IL_0341:  ldc.i4.1
4117  IL_0342:  callvirt   ""Windows.Languages.WinRTTest.UserDefinedStruct System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.this[int].get""
4118  IL_0347:  pop
4119  IL_0348:  dup
4120  IL_0349:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
4121  IL_034e:  ldc.i4.s   17
4122  IL_0350:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4123  IL_0355:  pop
4124  IL_0356:  dup
4125  IL_0357:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
4126  IL_035c:  dup
4127  IL_035d:  callvirt   ""System.Collections.Generic.ICollection<int> System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.Keys.get""
4128  IL_0362:  pop
4129  IL_0363:  dup
4130  IL_0364:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
4131  IL_0369:  ldc.i4.0
4132  IL_036a:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4133  IL_036f:  pop
4134  IL_0370:  dup
4135  IL_0371:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
4136  IL_0376:  dup
4137  IL_0377:  callvirt   ""System.Collections.Generic.ICollection<Windows.Languages.WinRTTest.UserDefinedStruct> System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.Values.get""
4138  IL_037c:  pop
4139  IL_037d:  dup
4140  IL_037e:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
4141  IL_0383:  ldc.i4.0
4142  IL_0384:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4143  IL_0389:  pop
4144  IL_038a:  dup
4145  IL_038b:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
4146  IL_0390:  dup
4147  IL_0391:  ldc.i4.1
4148  IL_0392:  ldloca.s   V_9
4149  IL_0394:  callvirt   ""bool System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.TryGetValue(int, out Windows.Languages.WinRTTest.UserDefinedStruct)""
4150  IL_0399:  stloc.s    V_10
4151  IL_039b:  dup
4152  IL_039c:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
4153  IL_03a1:  ldc.i4.s   17
4154  IL_03a3:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4155  IL_03a8:  pop
4156  IL_03a9:  ldloc.s    V_10
4157  IL_03ab:  box        ""bool""
4158  IL_03b0:  ldc.i4.1
4159  IL_03b1:  box        ""bool""
4160  IL_03b6:  call       ""bool AllMembers.ValidateValue(object, object)""
4161  IL_03bb:  pop
4162  IL_03bc:  dup
4163  IL_03bd:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
4164  IL_03c2:  dup
4165  IL_03c3:  ldc.i4.3
4166  IL_03c4:  ldloca.s   V_12
4167  IL_03c6:  initobj    ""Windows.Languages.WinRTTest.UserDefinedStruct""
4168  IL_03cc:  ldloca.s   V_12
4169  IL_03ce:  ldc.i4.4
4170  IL_03cf:  stfld      ""uint Windows.Languages.WinRTTest.UserDefinedStruct.Id""
4171  IL_03d4:  ldloc.s    V_12
4172  IL_03d6:  newobj     ""System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>..ctor(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
4173  IL_03db:  callvirt   ""void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Add(System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>)""
4174  IL_03e0:  dup
4175  IL_03e1:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
4176  IL_03e6:  ldc.i4.s   21
4177  IL_03e8:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4178  IL_03ed:  pop
4179  IL_03ee:  dup
4180  IL_03ef:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Count.get""
4181  IL_03f4:  box        ""int""
4182  IL_03f9:  ldc.i4.2
4183  IL_03fa:  box        ""int""
4184  IL_03ff:  call       ""bool AllMembers.ValidateValue(object, object)""
4185  IL_0404:  pop
4186  IL_0405:  dup
4187  IL_0406:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
4188  IL_040b:  dup
4189  IL_040c:  ldc.i4.1
4190  IL_040d:  ldloc.1
4191  IL_040e:  newobj     ""System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>..ctor(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
4192  IL_0413:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Contains(System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>)""
4193  IL_0418:  stloc.s    V_11
4194  IL_041a:  dup
4195  IL_041b:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
4196  IL_0420:  ldc.i4.s   17
4197  IL_0422:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4198  IL_0427:  pop
4199  IL_0428:  ldloc.s    V_11
4200  IL_042a:  box        ""bool""
4201  IL_042f:  ldc.i4.1
4202  IL_0430:  box        ""bool""
4203  IL_0435:  call       ""bool AllMembers.ValidateValue(object, object)""
4204  IL_043a:  pop
4205  IL_043b:  dup
4206  IL_043c:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
4207  IL_0441:  dup
4208  IL_0442:  ldc.i4.8
4209  IL_0443:  ldloca.s   V_12
4210  IL_0445:  initobj    ""Windows.Languages.WinRTTest.UserDefinedStruct""
4211  IL_044b:  ldloc.s    V_12
4212  IL_044d:  newobj     ""System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>..ctor(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
4213  IL_0452:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Contains(System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>)""
4214  IL_0457:  stloc.s    V_11
4215  IL_0459:  dup
4216  IL_045a:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
4217  IL_045f:  ldc.i4.s   19
4218  IL_0461:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4219  IL_0466:  pop
4220  IL_0467:  ldloc.s    V_11
4221  IL_0469:  box        ""bool""
4222  IL_046e:  ldc.i4.0
4223  IL_046f:  box        ""bool""
4224  IL_0474:  call       ""bool AllMembers.ValidateValue(object, object)""
4225  IL_0479:  pop
4226  IL_047a:  dup
4227  IL_047b:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
4228  IL_0480:  dup
4229  IL_0481:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
4230  IL_0486:  dup
4231  IL_0487:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Count.get""
4232  IL_048c:  stloc.s    V_4
4233  IL_048e:  dup
4234  IL_048f:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
4235  IL_0494:  ldc.i4.s   18
4236  IL_0496:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4237  IL_049b:  pop
4238  IL_049c:  ldloc.s    V_4
4239  IL_049e:  box        ""int""
4240  IL_04a3:  ldc.i4.1
4241  IL_04a4:  box        ""int""
4242  IL_04a9:  call       ""bool AllMembers.ValidateValue(object, object)""
4243  IL_04ae:  pop
4244  IL_04af:  dup
4245  IL_04b0:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
4246  IL_04b5:  dup
4247  IL_04b6:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.IsReadOnly.get""
4248  IL_04bb:  stloc.s    V_8
4249  IL_04bd:  dup
4250  IL_04be:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
4251  IL_04c3:  ldc.i4.0
4252  IL_04c4:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4253  IL_04c9:  pop
4254  IL_04ca:  ldloc.s    V_8
4255  IL_04cc:  box        ""bool""
4256  IL_04d1:  ldc.i4.0
4257  IL_04d2:  box        ""bool""
4258  IL_04d7:  call       ""bool AllMembers.ValidateValue(object, object)""
4259  IL_04dc:  pop
4260  IL_04dd:  dup
4261  IL_04de:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
4262  IL_04e3:  dup
4263  IL_04e4:  ldc.i4.1
4264  IL_04e5:  ldloc.1
4265  IL_04e6:  newobj     ""System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>..ctor(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
4266  IL_04eb:  callvirt   ""bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Remove(System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>)""
4267  IL_04f0:  pop
4268  IL_04f1:  dup
4269  IL_04f2:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
4270  IL_04f7:  ldc.i4.s   22
4271  IL_04f9:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4272  IL_04fe:  pop
4273  IL_04ff:  dup
4274  IL_0500:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Count.get""
4275  IL_0505:  box        ""int""
4276  IL_050a:  ldc.i4.0
4277  IL_050b:  box        ""int""
4278  IL_0510:  call       ""bool AllMembers.ValidateValue(object, object)""
4279  IL_0515:  pop
4280  IL_0516:  dup
4281  IL_0517:  ldc.i4.1
4282  IL_0518:  ldloc.1
4283  IL_0519:  callvirt   ""void System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.Add(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
4284  IL_051e:  dup
4285  IL_051f:  ldc.i4.2
4286  IL_0520:  ldloc.1
4287  IL_0521:  callvirt   ""void System.Collections.Generic.IDictionary<int, Windows.Languages.WinRTTest.UserDefinedStruct>.Add(int, Windows.Languages.WinRTTest.UserDefinedStruct)""
4288  IL_0526:  dup
4289  IL_0527:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
4290  IL_052c:  dup
4291  IL_052d:  callvirt   ""void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Clear()""
4292  IL_0532:  dup
4293  IL_0533:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
4294  IL_0538:  ldc.i4.s   23
4295  IL_053a:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4296  IL_053f:  pop
4297  IL_0540:  dup
4298  IL_0541:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Count.get""
4299  IL_0546:  box        ""int""
4300  IL_054b:  ldc.i4.0
4301  IL_054c:  box        ""int""
4302  IL_0551:  call       ""bool AllMembers.ValidateValue(object, object)""
4303  IL_0556:  pop
4304  IL_0557:  dup
4305  IL_0558:  callvirt   ""void Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.ClearFlag()""
4306  IL_055d:  dup
4307  IL_055e:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, Windows.Languages.WinRTTest.UserDefinedStruct>>.Count.get""
4308  IL_0563:  stloc.s    V_4
4309  IL_0565:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorStructIVectorViewStructIMapIntStructIMapViewIntStruct.GetFlagState()""
4310  IL_056a:  ldc.i4.s   18
4311  IL_056c:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4312  IL_0571:  pop
4313  IL_0572:  ret
4314}
4315");
4316        }
4317
4318        [Fact]
4319        public void LegacyCollectionTest05()
4320        {
4321            var source =
4322@"using Windows.Languages.WinRTTest;
4323using System.Collections.Generic;
4324using System.Reflection;
4325using System.Linq.Expressions;
4326using System;
4327using System.Linq;
4328
4329class AllMembers
4330{
4331    private static int FailedCount = 0;
4332    private static bool ValidateMethod(TestMethodCalled actual, TestMethodCalled expected)
4333    {
4334        var temp = Console.ForegroundColor;
4335        if (actual != expected)
4336        {
4337            FailedCount++;
4338            Console.ForegroundColor = ConsoleColor.Red;
4339            Console.Write(""FAIL:  "");
4340        }
4341        else
4342        {
4343            Console.ForegroundColor = ConsoleColor.Green;
4344            Console.Write(""PASS:  "");
4345        }
4346
4347        Console.ForegroundColor = temp;
4348        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
4349        return actual == expected;
4350    }
4351
4352    private static bool ValidateValue(object actual, object expected)
4353    {
4354        var temp = Console.ForegroundColor;
4355        if (actual.ToString() != expected.ToString())
4356        {
4357            FailedCount++;
4358            Console.ForegroundColor = ConsoleColor.Red;
4359            Console.Write(""FAIL:  "");
4360        }
4361        else
4362        {
4363            Console.ForegroundColor = ConsoleColor.Green;
4364            Console.Write(""PASS:  "");
4365        }
4366
4367        Console.ForegroundColor = temp;
4368        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
4369        return actual.ToString() == expected.ToString();
4370    }
4371
4372    static void TestISimpleInterfaceImplMembers()
4373    {
4374        ISimpleInterfaceImpl v = new ISimpleInterfaceImpl();
4375        //Add
4376        v.ClearFlag();
4377        v.Add(1);
4378        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Append);
4379        ValidateValue((v as IList<int>)[0], 1);
4380        //Contains
4381        v.ClearFlag();
4382        bool b = v.Contains(1);
4383        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
4384        ValidateValue(b, true);
4385        //CopyTo
4386        v.ClearFlag();
4387        int[] arr = new int[10];
4388        v.CopyTo(arr, 0);
4389        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
4390        ValidateValue(arr[0], 1);
4391        ValidateValue(arr[1], 0); //there should be nothing there! :)
4392        //GetEnumerator
4393        v.ClearFlag();
4394        int count = (v as IList<int>).Count;
4395        IEnumerator<int> enumerator = ((IEnumerable<int>)v).GetEnumerator();
4396        ValidateMethod(v.GetFlagState(), TestMethodCalled.IIterable_First);
4397        int index = 0;
4398        foreach (var e in v)
4399        {
4400            index = index + 1;
4401            ValidateValue(e, index);
4402        }
4403
4404        ValidateValue(index, 1); //there should only be 1 element there
4405        //IndexOf
4406        v.ClearFlag();
4407        var rez = v.IndexOf(1);
4408        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
4409        ValidateValue(rez, 0); // 1 is on the first line :)
4410        //Insert
4411        v.ClearFlag();
4412        v.Insert(1, 2);
4413        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_InsertAt);
4414        ValidateValue((v as IList<int>)[1], 2);
4415        //IsReadOnly
4416        v.ClearFlag();
4417        bool isReadOnly = v.IsReadOnly;
4418        ValidateMethod(v.GetFlagState(), TestMethodCalled.NotSet);
4419        ValidateValue(isReadOnly, false);
4420        //Indexing
4421        v.ClearFlag();
4422        int val = (v as IList<int>)[0];
4423        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
4424        ValidateValue(val, 1);
4425        v.ClearFlag();
4426        val = ((IList<int>)v)[1];
4427        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
4428        ValidateValue(val, 2);
4429        //Remove
4430        v.ClearFlag();
4431        v.Remove(1);
4432        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
4433        ValidateValue((v as IList<int>).Count, 1);
4434        //RemoveAt
4435        v.ClearFlag();
4436        v.RemoveAt(0);
4437        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_RemoveAt);
4438        ValidateValue((v as IList<int>).Count, 0);
4439        //Clear
4440        v.Add(1);
4441        v.Add(2);
4442        v.ClearFlag();
4443        //v.Clear();
4444        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Clear);
4445        ValidateValue((v as IList<int>).Count, 0);
4446    }
4447
4448    static int Main()
4449    {
4450        TestISimpleInterfaceImplMembers();
4451        
4452        Console.WriteLine(FailedCount);
4453        return FailedCount;
4454    }
4455}";
4456            var verifier = CompileAndVerify(source,
4457                additionalRefs: LegacyRefs,
4458                emitOptions: EmitOptions.RefEmitBug,
4459                verify: false);
4460            verifier.VerifyDiagnostics(
4461                // (3,1): info CS8019: Unnecessary using directive.
4462                // using System.Reflection;
4463                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Reflection;"),
4464                // (4,1): info CS8019: Unnecessary using directive.
4465                // using System.Linq.Expressions;
4466                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq.Expressions;"),
4467                // (6,1): info CS8019: Unnecessary using directive.
4468                // using System.Linq;
4469                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq;"));
4470            verifier.VerifyIL("AllMembers.TestISimpleInterfaceImplMembers",
4471@"{
4472  // Code size      686 (0x2ae)
4473  .maxstack  3
4474  .locals init (Windows.Languages.WinRTTest.ISimpleInterfaceImpl V_0, //v
4475  bool V_1, //b
4476  int[] V_2, //arr
4477  int V_3, //index
4478  int V_4, //rez
4479  bool V_5, //isReadOnly
4480  int V_6, //val
4481  System.Collections.Generic.IEnumerator<int> V_7)
4482  IL_0000:  newobj     ""Windows.Languages.WinRTTest.ISimpleInterfaceImpl..ctor()""
4483  IL_0005:  stloc.0
4484  IL_0006:  ldloc.0
4485  IL_0007:  callvirt   ""void Windows.Languages.WinRTTest.ISimpleInterfaceImpl.ClearFlag()""
4486  IL_000c:  ldloc.0
4487  IL_000d:  ldc.i4.1
4488  IL_000e:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
4489  IL_0013:  ldloc.0
4490  IL_0014:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.ISimpleInterfaceImpl.GetFlagState()""
4491  IL_0019:  ldc.i4.s   9
4492  IL_001b:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4493  IL_0020:  pop
4494  IL_0021:  ldloc.0
4495  IL_0022:  ldc.i4.0
4496  IL_0023:  callvirt   ""int System.Collections.Generic.IList<int>.this[int].get""
4497  IL_0028:  box        ""int""
4498  IL_002d:  ldc.i4.1
4499  IL_002e:  box        ""int""
4500  IL_0033:  call       ""bool AllMembers.ValidateValue(object, object)""
4501  IL_0038:  pop
4502  IL_0039:  ldloc.0
4503  IL_003a:  callvirt   ""void Windows.Languages.WinRTTest.ISimpleInterfaceImpl.ClearFlag()""
4504  IL_003f:  ldloc.0
4505  IL_0040:  ldc.i4.1
4506  IL_0041:  callvirt   ""bool System.Collections.Generic.ICollection<int>.Contains(int)""
4507  IL_0046:  stloc.1
4508  IL_0047:  ldloc.0
4509  IL_0048:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.ISimpleInterfaceImpl.GetFlagState()""
4510  IL_004d:  ldc.i4.5
4511  IL_004e:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4512  IL_0053:  pop
4513  IL_0054:  ldloc.1
4514  IL_0055:  box        ""bool""
4515  IL_005a:  ldc.i4.1
4516  IL_005b:  box        ""bool""
4517  IL_0060:  call       ""bool AllMembers.ValidateValue(object, object)""
4518  IL_0065:  pop
4519  IL_0066:  ldloc.0
4520  IL_0067:  callvirt   ""void Windows.Languages.WinRTTest.ISimpleInterfaceImpl.ClearFlag()""
4521  IL_006c:  ldc.i4.s   10
4522  IL_006e:  newarr     ""int""
4523  IL_0073:  stloc.2
4524  IL_0074:  ldloc.0
4525  IL_0075:  ldloc.2
4526  IL_0076:  ldc.i4.0
4527  IL_0077:  callvirt   ""void System.Collections.Generic.ICollection<int>.CopyTo(int[], int)""
4528  IL_007c:  ldloc.0
4529  IL_007d:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.ISimpleInterfaceImpl.GetFlagState()""
4530  IL_0082:  ldc.i4.2
4531  IL_0083:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4532  IL_0088:  pop
4533  IL_0089:  ldloc.2
4534  IL_008a:  ldc.i4.0
4535  IL_008b:  ldelem.i4
4536  IL_008c:  box        ""int""
4537  IL_0091:  ldc.i4.1
4538  IL_0092:  box        ""int""
4539  IL_0097:  call       ""bool AllMembers.ValidateValue(object, object)""
4540  IL_009c:  pop
4541  IL_009d:  ldloc.2
4542  IL_009e:  ldc.i4.1
4543  IL_009f:  ldelem.i4
4544  IL_00a0:  box        ""int""
4545  IL_00a5:  ldc.i4.0
4546  IL_00a6:  box        ""int""
4547  IL_00ab:  call       ""bool AllMembers.ValidateValue(object, object)""
4548  IL_00b0:  pop
4549  IL_00b1:  ldloc.0
4550  IL_00b2:  callvirt   ""void Windows.Languages.WinRTTest.ISimpleInterfaceImpl.ClearFlag()""
4551  IL_00b7:  ldloc.0
4552  IL_00b8:  callvirt   ""int System.Collections.Generic.ICollection<int>.Count.get""
4553  IL_00bd:  pop
4554  IL_00be:  ldloc.0
4555  IL_00bf:  callvirt   ""System.Collections.Generic.IEnumerator<int> System.Collections.Generic.IEnumerable<int>.GetEnumerator()""
4556  IL_00c4:  pop
4557  IL_00c5:  ldloc.0
4558  IL_00c6:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.ISimpleInterfaceImpl.GetFlagState()""
4559  IL_00cb:  ldc.i4.1
4560  IL_00cc:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4561  IL_00d1:  pop
4562  IL_00d2:  ldc.i4.0
4563  IL_00d3:  stloc.3
4564  IL_00d4:  ldloc.0
4565  IL_00d5:  callvirt   ""System.Collections.Generic.IEnumerator<int> System.Collections.Generic.IEnumerable<int>.GetEnumerator()""
4566  IL_00da:  stloc.s    V_7
4567  .try
4568{
4569  IL_00dc:  br.s       IL_00fa
4570  IL_00de:  ldloc.s    V_7
4571  IL_00e0:  callvirt   ""int System.Collections.Generic.IEnumerator<int>.Current.get""
4572  IL_00e5:  ldloc.3
4573  IL_00e6:  ldc.i4.1
4574  IL_00e7:  add
4575  IL_00e8:  stloc.3
4576  IL_00e9:  box        ""int""
4577  IL_00ee:  ldloc.3
4578  IL_00ef:  box        ""int""
4579  IL_00f4:  call       ""bool AllMembers.ValidateValue(object, object)""
4580  IL_00f9:  pop
4581  IL_00fa:  ldloc.s    V_7
4582  IL_00fc:  callvirt   ""bool System.Collections.IEnumerator.MoveNext()""
4583  IL_0101:  brtrue.s   IL_00de
4584  IL_0103:  leave.s    IL_0111
4585}
4586  finally
4587{
4588  IL_0105:  ldloc.s    V_7
4589  IL_0107:  brfalse.s  IL_0110
4590  IL_0109:  ldloc.s    V_7
4591  IL_010b:  callvirt   ""void System.IDisposable.Dispose()""
4592  IL_0110:  endfinally
4593}
4594  IL_0111:  ldloc.3
4595  IL_0112:  box        ""int""
4596  IL_0117:  ldc.i4.1
4597  IL_0118:  box        ""int""
4598  IL_011d:  call       ""bool AllMembers.ValidateValue(object, object)""
4599  IL_0122:  pop
4600  IL_0123:  ldloc.0
4601  IL_0124:  callvirt   ""void Windows.Languages.WinRTTest.ISimpleInterfaceImpl.ClearFlag()""
4602  IL_0129:  ldloc.0
4603  IL_012a:  ldc.i4.1
4604  IL_012b:  callvirt   ""int System.Collections.Generic.IList<int>.IndexOf(int)""
4605  IL_0130:  stloc.s    V_4
4606  IL_0132:  ldloc.0
4607  IL_0133:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.ISimpleInterfaceImpl.GetFlagState()""
4608  IL_0138:  ldc.i4.5
4609  IL_0139:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4610  IL_013e:  pop
4611  IL_013f:  ldloc.s    V_4
4612  IL_0141:  box        ""int""
4613  IL_0146:  ldc.i4.0
4614  IL_0147:  box        ""int""
4615  IL_014c:  call       ""bool AllMembers.ValidateValue(object, object)""
4616  IL_0151:  pop
4617  IL_0152:  ldloc.0
4618  IL_0153:  callvirt   ""void Windows.Languages.WinRTTest.ISimpleInterfaceImpl.ClearFlag()""
4619  IL_0158:  ldloc.0
4620  IL_0159:  ldc.i4.1
4621  IL_015a:  ldc.i4.2
4622  IL_015b:  callvirt   ""void System.Collections.Generic.IList<int>.Insert(int, int)""
4623  IL_0160:  ldloc.0
4624  IL_0161:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.ISimpleInterfaceImpl.GetFlagState()""
4625  IL_0166:  ldc.i4.7
4626  IL_0167:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4627  IL_016c:  pop
4628  IL_016d:  ldloc.0
4629  IL_016e:  ldc.i4.1
4630  IL_016f:  callvirt   ""int System.Collections.Generic.IList<int>.this[int].get""
4631  IL_0174:  box        ""int""
4632  IL_0179:  ldc.i4.2
4633  IL_017a:  box        ""int""
4634  IL_017f:  call       ""bool AllMembers.ValidateValue(object, object)""
4635  IL_0184:  pop
4636  IL_0185:  ldloc.0
4637  IL_0186:  callvirt   ""void Windows.Languages.WinRTTest.ISimpleInterfaceImpl.ClearFlag()""
4638  IL_018b:  ldloc.0
4639  IL_018c:  callvirt   ""bool System.Collections.Generic.ICollection<int>.IsReadOnly.get""
4640  IL_0191:  stloc.s    V_5
4641  IL_0193:  ldloc.0
4642  IL_0194:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.ISimpleInterfaceImpl.GetFlagState()""
4643  IL_0199:  ldc.i4.0
4644  IL_019a:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4645  IL_019f:  pop
4646  IL_01a0:  ldloc.s    V_5
4647  IL_01a2:  box        ""bool""
4648  IL_01a7:  ldc.i4.0
4649  IL_01a8:  box        ""bool""
4650  IL_01ad:  call       ""bool AllMembers.ValidateValue(object, object)""
4651  IL_01b2:  pop
4652  IL_01b3:  ldloc.0
4653  IL_01b4:  callvirt   ""void Windows.Languages.WinRTTest.ISimpleInterfaceImpl.ClearFlag()""
4654  IL_01b9:  ldloc.0
4655  IL_01ba:  ldc.i4.0
4656  IL_01bb:  callvirt   ""int System.Collections.Generic.IList<int>.this[int].get""
4657  IL_01c0:  stloc.s    V_6
4658  IL_01c2:  ldloc.0
4659  IL_01c3:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.ISimpleInterfaceImpl.GetFlagState()""
4660  IL_01c8:  ldc.i4.2
4661  IL_01c9:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4662  IL_01ce:  pop
4663  IL_01cf:  ldloc.s    V_6
4664  IL_01d1:  box        ""int""
4665  IL_01d6:  ldc.i4.1
4666  IL_01d7:  box        ""int""
4667  IL_01dc:  call       ""bool AllMembers.ValidateValue(object, object)""
4668  IL_01e1:  pop
4669  IL_01e2:  ldloc.0
4670  IL_01e3:  callvirt   ""void Windows.Languages.WinRTTest.ISimpleInterfaceImpl.ClearFlag()""
4671  IL_01e8:  ldloc.0
4672  IL_01e9:  ldc.i4.1
4673  IL_01ea:  callvirt   ""int System.Collections.Generic.IList<int>.this[int].get""
4674  IL_01ef:  stloc.s    V_6
4675  IL_01f1:  ldloc.0
4676  IL_01f2:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.ISimpleInterfaceImpl.GetFlagState()""
4677  IL_01f7:  ldc.i4.2
4678  IL_01f8:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4679  IL_01fd:  pop
4680  IL_01fe:  ldloc.s    V_6
4681  IL_0200:  box        ""int""
4682  IL_0205:  ldc.i4.2
4683  IL_0206:  box        ""int""
4684  IL_020b:  call       ""bool AllMembers.ValidateValue(object, object)""
4685  IL_0210:  pop
4686  IL_0211:  ldloc.0
4687  IL_0212:  callvirt   ""void Windows.Languages.WinRTTest.ISimpleInterfaceImpl.ClearFlag()""
4688  IL_0217:  ldloc.0
4689  IL_0218:  ldc.i4.1
4690  IL_0219:  callvirt   ""bool System.Collections.Generic.ICollection<int>.Remove(int)""
4691  IL_021e:  pop
4692  IL_021f:  ldloc.0
4693  IL_0220:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.ISimpleInterfaceImpl.GetFlagState()""
4694  IL_0225:  ldc.i4.8
4695  IL_0226:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4696  IL_022b:  pop
4697  IL_022c:  ldloc.0
4698  IL_022d:  callvirt   ""int System.Collections.Generic.ICollection<int>.Count.get""
4699  IL_0232:  box        ""int""
4700  IL_0237:  ldc.i4.1
4701  IL_0238:  box        ""int""
4702  IL_023d:  call       ""bool AllMembers.ValidateValue(object, object)""
4703  IL_0242:  pop
4704  IL_0243:  ldloc.0
4705  IL_0244:  callvirt   ""void Windows.Languages.WinRTTest.ISimpleInterfaceImpl.ClearFlag()""
4706  IL_0249:  ldloc.0
4707  IL_024a:  ldc.i4.0
4708  IL_024b:  callvirt   ""void System.Collections.Generic.IList<int>.RemoveAt(int)""
4709  IL_0250:  ldloc.0
4710  IL_0251:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.ISimpleInterfaceImpl.GetFlagState()""
4711  IL_0256:  ldc.i4.8
4712  IL_0257:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4713  IL_025c:  pop
4714  IL_025d:  ldloc.0
4715  IL_025e:  callvirt   ""int System.Collections.Generic.ICollection<int>.Count.get""
4716  IL_0263:  box        ""int""
4717  IL_0268:  ldc.i4.0
4718  IL_0269:  box        ""int""
4719  IL_026e:  call       ""bool AllMembers.ValidateValue(object, object)""
4720  IL_0273:  pop
4721  IL_0274:  ldloc.0
4722  IL_0275:  ldc.i4.1
4723  IL_0276:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
4724  IL_027b:  ldloc.0
4725  IL_027c:  ldc.i4.2
4726  IL_027d:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
4727  IL_0282:  ldloc.0
4728  IL_0283:  callvirt   ""void Windows.Languages.WinRTTest.ISimpleInterfaceImpl.ClearFlag()""
4729  IL_0288:  ldloc.0
4730  IL_0289:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.ISimpleInterfaceImpl.GetFlagState()""
4731  IL_028e:  ldc.i4.s   11
4732  IL_0290:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
4733  IL_0295:  pop
4734  IL_0296:  ldloc.0
4735  IL_0297:  callvirt   ""int System.Collections.Generic.ICollection<int>.Count.get""
4736  IL_029c:  box        ""int""
4737  IL_02a1:  ldc.i4.0
4738  IL_02a2:  box        ""int""
4739  IL_02a7:  call       ""bool AllMembers.ValidateValue(object, object)""
4740  IL_02ac:  pop
4741  IL_02ad:  ret
4742}");
4743        }
4744
4745        [Fact]
4746        public void LegacyCollectionTest06()
4747        {
4748            var source =
4749@"using Windows.Languages.WinRTTest;
4750using System.Collections.Generic;
4751using System.Reflection;
4752using System.Linq.Expressions;
4753using System;
4754using System.Linq;
4755
4756class AllMembers
4757{
4758    private static int FailedCount = 0;
4759    private static bool ValidateMethod(TestMethodCalled actual, TestMethodCalled expected)
4760    {
4761        var temp = Console.ForegroundColor;
4762        if (actual != expected)
4763        {
4764            FailedCount++;
4765            Console.ForegroundColor = ConsoleColor.Red;
4766            Console.Write(""FAIL:  "");
4767        }
4768        else
4769        {
4770            Console.ForegroundColor = ConsoleColor.Green;
4771            Console.Write(""PASS:  "");
4772        }
4773
4774        Console.ForegroundColor = temp;
4775        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
4776        return actual == expected;
4777    }
4778
4779    private static bool ValidateValue(object actual, object expected)
4780    {
4781        var temp = Console.ForegroundColor;
4782        if (actual.ToString() != expected.ToString())
4783        {
4784            FailedCount++;
4785            Console.ForegroundColor = ConsoleColor.Red;
4786            Console.Write(""FAIL:  "");
4787        }
4788        else
4789        {
4790            Console.ForegroundColor = ConsoleColor.Green;
4791            Console.Write(""PASS:  "");
4792        }
4793
4794        Console.ForegroundColor = temp;
4795        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
4796        return actual.ToString() == expected.ToString();
4797    }
4798
4799    static void TestCollectionInitializers()
4800    {
4801        var v = new IVectorInt() { 1, 2, 3, 4, 5 };
4802        ValidateValue(v.Count, 5);
4803        var m = new IMapIntInt() { { 1, 2 }, { 2, 3 } };
4804        ValidateValue(m.Count, 2);
4805        var t = new Dictionary<int, IVectorInt>()        
4806        {        
4807            {1, new IVectorInt(){1, 2, 3}},
4808            {2, new IVectorInt(){4, 5, 6}}
4809        };
4810        ValidateValue(t[1][2], 3);
4811        ValidateValue(t[2][2], 6);
4812    }
4813
4814
4815    static int Main()
4816    {
4817        TestCollectionInitializers();
4818        
4819        Console.WriteLine(FailedCount);
4820        return FailedCount;
4821    }
4822}";
4823            var verifier = CompileAndVerify(source,
4824                additionalRefs: LegacyRefs,
4825                emitOptions: EmitOptions.RefEmitBug,
4826                verify: false);
4827            verifier.VerifyDiagnostics(
4828                // (3,1): info CS8019: Unnecessary using directive.
4829                // using System.Reflection;
4830                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Reflection;"),
4831                // (4,1): info CS8019: Unnecessary using directive.
4832                // using System.Linq.Expressions;
4833                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq.Expressions;"),
4834                // (6,1): info CS8019: Unnecessary using directive.
4835                // using System.Linq;
4836                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq;"));
4837            verifier.VerifyIL("AllMembers.TestCollectionInitializers",
4838@"{
4839  // Code size      236 (0xec)
4840  .maxstack  6
4841  IL_0000:  newobj     ""Windows.Languages.WinRTTest.IVectorInt..ctor()""
4842  IL_0005:  dup
4843  IL_0006:  ldc.i4.1
4844  IL_0007:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
4845  IL_000c:  dup
4846  IL_000d:  ldc.i4.2
4847  IL_000e:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
4848  IL_0013:  dup
4849  IL_0014:  ldc.i4.3
4850  IL_0015:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
4851  IL_001a:  dup
4852  IL_001b:  ldc.i4.4
4853  IL_001c:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
4854  IL_0021:  dup
4855  IL_0022:  ldc.i4.5
4856  IL_0023:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
4857  IL_0028:  callvirt   ""int System.Collections.Generic.ICollection<int>.Count.get""
4858  IL_002d:  box        ""int""
4859  IL_0032:  ldc.i4.5
4860  IL_0033:  box        ""int""
4861  IL_0038:  call       ""bool AllMembers.ValidateValue(object, object)""
4862  IL_003d:  pop
4863  IL_003e:  newobj     ""Windows.Languages.WinRTTest.IMapIntInt..ctor()""
4864  IL_0043:  dup
4865  IL_0044:  ldc.i4.1
4866  IL_0045:  ldc.i4.2
4867  IL_0046:  callvirt   ""void System.Collections.Generic.IDictionary<int, int>.Add(int, int)""
4868  IL_004b:  dup
4869  IL_004c:  ldc.i4.2
4870  IL_004d:  ldc.i4.3
4871  IL_004e:  callvirt   ""void System.Collections.Generic.IDictionary<int, int>.Add(int, int)""
4872  IL_0053:  callvirt   ""int System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<int, int>>.Count.get""
4873  IL_0058:  box        ""int""
4874  IL_005d:  ldc.i4.2
4875  IL_005e:  box        ""int""
4876  IL_0063:  call       ""bool AllMembers.ValidateValue(object, object)""
4877  IL_0068:  pop
4878  IL_0069:  newobj     ""System.Collections.Generic.Dictionary<int, Windows.Languages.WinRTTest.IVectorInt>..ctor()""
4879  IL_006e:  dup
4880  IL_006f:  ldc.i4.1
4881  IL_0070:  newobj     ""Windows.Languages.WinRTTest.IVectorInt..ctor()""
4882  IL_0075:  dup
4883  IL_0076:  ldc.i4.1
4884  IL_0077:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
4885  IL_007c:  dup
4886  IL_007d:  ldc.i4.2
4887  IL_007e:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
4888  IL_0083:  dup
4889  IL_0084:  ldc.i4.3
4890  IL_0085:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
4891  IL_008a:  callvirt   ""void System.Collections.Generic.Dictionary<int, Windows.Languages.WinRTTest.IVectorInt>.Add(int, Windows.Languages.WinRTTest.IVectorInt)""
4892  IL_008f:  dup
4893  IL_0090:  ldc.i4.2
4894  IL_0091:  newobj     ""Windows.Languages.WinRTTest.IVectorInt..ctor()""
4895  IL_0096:  dup
4896  IL_0097:  ldc.i4.4
4897  IL_0098:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
4898  IL_009d:  dup
4899  IL_009e:  ldc.i4.5
4900  IL_009f:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
4901  IL_00a4:  dup
4902  IL_00a5:  ldc.i4.6
4903  IL_00a6:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
4904  IL_00ab:  callvirt   ""void System.Collections.Generic.Dictionary<int, Windows.Languages.WinRTTest.IVectorInt>.Add(int, Windows.Languages.WinRTTest.IVectorInt)""
4905  IL_00b0:  dup
4906  IL_00b1:  ldc.i4.1
4907  IL_00b2:  callvirt   ""Windows.Languages.WinRTTest.IVectorInt System.Collections.Generic.Dictionary<int, Windows.Languages.WinRTTest.IVectorInt>.this[int].get""
4908  IL_00b7:  ldc.i4.2
4909  IL_00b8:  callvirt   ""int System.Collections.Generic.IList<int>.this[int].get""
4910  IL_00bd:  box        ""int""
4911  IL_00c2:  ldc.i4.3
4912  IL_00c3:  box        ""int""
4913  IL_00c8:  call       ""bool AllMembers.ValidateValue(object, object)""
4914  IL_00cd:  pop
4915  IL_00ce:  ldc.i4.2
4916  IL_00cf:  callvirt   ""Windows.Languages.WinRTTest.IVectorInt System.Collections.Generic.Dictionary<int, Windows.Languages.WinRTTest.IVectorInt>.this[int].get""
4917  IL_00d4:  ldc.i4.2
4918  IL_00d5:  callvirt   ""int System.Collections.Generic.IList<int>.this[int].get""
4919  IL_00da:  box        ""int""
4920  IL_00df:  ldc.i4.6
4921  IL_00e0:  box        ""int""
4922  IL_00e5:  call       ""bool AllMembers.ValidateValue(object, object)""
4923  IL_00ea:  pop
4924  IL_00eb:  ret
4925}");
4926        }
4927
4928        [Fact]
4929        public void LegacyCollectionTest07()
4930        {
4931            var source =
4932@"using Windows.Languages.WinRTTest;
4933using System.Collections.Generic;
4934using System.Reflection;
4935using System.Linq.Expressions;
4936using System;
4937using System.Linq;
4938
4939class AllMembers
4940{
4941    private static int FailedCount = 0;
4942    private static bool ValidateMethod(TestMethodCalled actual, TestMethodCalled expected)
4943    {
4944        var temp = Console.ForegroundColor;
4945        if (actual != expected)
4946        {
4947            FailedCount++;
4948            Console.ForegroundColor = ConsoleColor.Red;
4949            Console.Write(""FAIL:  "");
4950        }
4951        else
4952        {
4953            Console.ForegroundColor = ConsoleColor.Green;
4954            Console.Write(""PASS:  "");
4955        }
4956
4957        Console.ForegroundColor = temp;
4958        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
4959        return actual == expected;
4960    }
4961
4962    private static bool ValidateValue(object actual, object expected)
4963    {
4964        var temp = Console.ForegroundColor;
4965        if (actual.ToString() != expected.ToString())
4966        {
4967            FailedCount++;
4968            Console.ForegroundColor = ConsoleColor.Red;
4969            Console.Write(""FAIL:  "");
4970        }
4971        else
4972        {
4973            Console.ForegroundColor = ConsoleColor.Green;
4974            Console.Write(""PASS:  "");
4975        }
4976
4977        Console.ForegroundColor = temp;
4978        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
4979        return actual.ToString() == expected.ToString();
4980    }
4981
4982    static void TestExpressionTreeCompiler()
4983    {
4984        var v = new IVectorInt();
4985        try
4986        {
4987            // Dev11:205875
4988            Console.WriteLine(""Dev11:205875"");
4989            ValidateValue(true, true);
4990            Expression<Action<int>> expr = (val) => v.Add(val);
4991            v.ClearFlag();
4992            expr.Compile()(1);
4993            ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Append);
4994        }
4995        catch (Exception e)
4996        {
4997            Console.WriteLine(""ExprTree compiler"");
4998            Console.WriteLine(e.Message);
4999        }
5000    }
5001
5002    static int Main()
5003    {
5004        TestExpressionTreeCompiler();
5005
5006        Console.WriteLine(FailedCount);
5007        return FailedCount;
5008    }
5009}";
5010            var verifier = CompileAndVerify(source,
5011                additionalRefs: LegacyRefs,
5012                emitOptions: EmitOptions.RefEmitBug,
5013                verify: false);
5014
5015            verifier.VerifyDiagnostics(
5016                // (2,1): info CS8019: Unnecessary using directive.
5017                // using System.Collections.Generic;
5018                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Collections.Generic;"),
5019                // (3,1): info CS8019: Unnecessary using directive.
5020                // using System.Reflection;
5021                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Reflection;"),
5022                // (6,1): info CS8019: Unnecessary using directive.
5023                // using System.Linq;
5024                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq;"));
5025
5026            verifier.VerifyIL("AllMembers.TestExpressionTreeCompiler",
5027@"
5028{
5029  // Code size      213 (0xd5)
5030  .maxstack  6
5031  .locals init (AllMembers.<>c__DisplayClass0 V_0, //CS$<>8__locals0
5032  System.Linq.Expressions.ParameterExpression V_1)
5033  IL_0000:  newobj     ""AllMembers.<>c__DisplayClass0..ctor()""
5034  IL_0005:  stloc.0
5035  IL_0006:  ldloc.0
5036  IL_0007:  newobj     ""Windows.Languages.WinRTTest.IVectorInt..ctor()""
5037  IL_000c:  stfld      ""Windows.Languages.WinRTTest.IVectorInt AllMembers.<>c__DisplayClass0.v""
5038  .try
5039{
5040  IL_0011:  ldstr      ""Dev11:205875""
5041  IL_0016:  call       ""void System.Console.WriteLine(string)""
5042  IL_001b:  ldc.i4.1
5043  IL_001c:  box        ""bool""
5044  IL_0021:  ldc.i4.1
5045  IL_0022:  box        ""bool""
5046  IL_0027:  call       ""bool AllMembers.ValidateValue(object, object)""
5047  IL_002c:  pop
5048  IL_002d:  ldtoken    ""int""
5049  IL_0032:  call       ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)""
5050  IL_0037:  ldstr      ""val""
5051  IL_003c:  call       ""System.Linq.Expressions.ParameterExpression System.Linq.Expressions.Expression.Parameter(System.Type, string)""
5052  IL_0041:  stloc.1
5053  IL_0042:  ldloc.0
5054  IL_0043:  ldtoken    ""AllMembers.<>c__DisplayClass0""
5055  IL_0048:  call       ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)""
5056  IL_004d:  call       ""System.Linq.Expressions.ConstantExpression System.Linq.Expressions.Expression.Constant(object, System.Type)""
5057  IL_0052:  ldtoken    ""Windows.Languages.WinRTTest.IVectorInt AllMembers.<>c__DisplayClass0.v""
5058  IL_0057:  call       ""System.Reflection.FieldInfo System.Reflection.FieldInfo.GetFieldFromHandle(System.RuntimeFieldHandle)""
5059  IL_005c:  call       ""System.Linq.Expressions.MemberExpression System.Linq.Expressions.Expression.Field(System.Linq.Expressions.Expression, System.Reflection.FieldInfo)""
5060  IL_0061:  ldtoken    ""void System.Collections.Generic.ICollection<int>.Add(int)""
5061  IL_0066:  ldtoken    ""System.Collections.Generic.ICollection<int>""
5062  IL_006b:  call       ""System.Reflection.MethodBase System.Reflection.MethodBase.GetMethodFromHandle(System.RuntimeMethodHandle, System.RuntimeTypeHandle)""
5063  IL_0070:  castclass  ""System.Reflection.MethodInfo""
5064  IL_0075:  ldc.i4.1
5065  IL_0076:  newarr     ""System.Linq.Expressions.Expression""
5066  IL_007b:  dup
5067  IL_007c:  ldc.i4.0
5068  IL_007d:  ldloc.1
5069  IL_007e:  stelem.ref
5070  IL_007f:  call       ""System.Linq.Expressions.MethodCallExpression System.Linq.Expressions.Expression.Call(System.Linq.Expressions.Expression, System.Reflection.MethodInfo, params System.Linq.Expressions.Expression[])""
5071  IL_0084:  ldc.i4.1
5072  IL_0085:  newarr     ""System.Linq.Expressions.ParameterExpression""
5073  IL_008a:  dup
5074  IL_008b:  ldc.i4.0
5075  IL_008c:  ldloc.1
5076  IL_008d:  stelem.ref
5077  IL_008e:  call       ""System.Linq.Expressions.Expression<System.Action<int>> System.Linq.Expressions.Expression.Lambda<System.Action<int>>(System.Linq.Expressions.Expression, params System.Linq.Expressions.ParameterExpression[])""
5078  IL_0093:  ldloc.0
5079  IL_0094:  ldfld      ""Windows.Languages.WinRTTest.IVectorInt AllMembers.<>c__DisplayClass0.v""
5080  IL_0099:  callvirt   ""void Windows.Languages.WinRTTest.IVectorInt.ClearFlag()""
5081  IL_009e:  callvirt   ""System.Action<int> System.Linq.Expressions.Expression<System.Action<int>>.Compile()""
5082  IL_00a3:  ldc.i4.1
5083  IL_00a4:  callvirt   ""void System.Action<int>.Invoke(int)""
5084  IL_00a9:  ldloc.0
5085  IL_00aa:  ldfld      ""Windows.Languages.WinRTTest.IVectorInt AllMembers.<>c__DisplayClass0.v""
5086  IL_00af:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorInt.GetFlagState()""
5087  IL_00b4:  ldc.i4.s   9
5088  IL_00b6:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
5089  IL_00bb:  pop
5090  IL_00bc:  leave.s    IL_00d4
5091}
5092  catch System.Exception
5093{
5094  IL_00be:  ldstr      ""ExprTree compiler""
5095  IL_00c3:  call       ""void System.Console.WriteLine(string)""
5096  IL_00c8:  callvirt   ""string System.Exception.Message.get""
5097  IL_00cd:  call       ""void System.Console.WriteLine(string)""
5098  IL_00d2:  leave.s    IL_00d4
5099}
5100  IL_00d4:  ret
5101}");
5102        }
5103
5104        [Fact]
5105        public void LegacyCollectionTest09()
5106        {
5107            var source =
5108@"using Windows.Languages.WinRTTest;
5109using System.Collections.Generic;
5110using System.Reflection;
5111using System.Linq.Expressions;
5112using System;
5113using System.Linq;
5114
5115class AllMembers
5116{
5117    private static int FailedCount = 0;
5118    private static bool ValidateMethod(TestMethodCalled actual, TestMethodCalled expected)
5119    {
5120        var temp = Console.ForegroundColor;
5121        if (actual != expected)
5122        {
5123            FailedCount++;
5124            Console.ForegroundColor = ConsoleColor.Red;
5125            Console.Write(""FAIL:  "");
5126        }
5127        else
5128        {
5129            Console.ForegroundColor = ConsoleColor.Green;
5130            Console.Write(""PASS:  "");
5131        }
5132
5133        Console.ForegroundColor = temp;
5134        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
5135        return actual == expected;
5136    }
5137
5138    private static bool ValidateValue(object actual, object expected)
5139    {
5140        var temp = Console.ForegroundColor;
5141        if (actual.ToString() != expected.ToString())
5142        {
5143            FailedCount++;
5144            Console.ForegroundColor = ConsoleColor.Red;
5145            Console.Write(""FAIL:  "");
5146        }
5147        else
5148        {
5149            Console.ForegroundColor = ConsoleColor.Green;
5150            Console.Write(""PASS:  "");
5151        }
5152
5153        Console.ForegroundColor = temp;
5154        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
5155        return actual.ToString() == expected.ToString();
5156    }
5157
5158    static void TestLINQ()
5159    {
5160        var v = new IVectorInt() { 1, 2, 3, 4, 5 };
5161        ValidateValue(v.Count, 5);
5162        // Use methods on v inside query operator
5163        v.ClearFlag();
5164        var rez = from e in new int[] { 2, 4, 6, 10, 12 }
5165                  where v.Contains(e)
5166                  select e;
5167        rez = rez.ToList();
5168
5169        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
5170        ValidateValue(rez.Count(), 2);
5171        ValidateValue(rez.ToArray()[0], 2);
5172        ValidateValue(rez.ToArray()[1], 4);
5173
5174        //Use v as source to linq query
5175        rez = from e in v
5176              where e % 2 == 0
5177              select e;
5178        rez = rez.ToList();
5179        ValidateMethod(v.GetFlagState(), TestMethodCalled.IIterable_First);
5180        ValidateValue(rez.Count(), 2);
5181
5182        //over IQueryable
5183        try
5184        {
5185            Console.WriteLine(""Dev11:205875"");
5186            ValidateValue(false, false);
5187            //var list = new List<int>() { 1, 2, 3, 4, 5 };
5188            //var otherRez = from e in list.AsQueryable()
5189            //               where v.Contains(e)
5190            //               select e;
5191            //var vals = otherRez.ToArray();
5192        }
5193        catch (ArgumentException e)
5194        {
5195            Console.WriteLine(""TestLINQ"");
5196            Console.WriteLine(e.Message);
5197        }
5198    }
5199
5200    static int Main()
5201    {
5202        TestLINQ();
5203
5204        Console.WriteLine(FailedCount);
5205        return FailedCount;
5206    }
5207}";
5208            var verifier = CompileAndVerify(source,
5209                additionalRefs: LegacyRefs,
5210                emitOptions: EmitOptions.RefEmitBug,
5211                verify: false);
5212
5213            verifier.VerifyDiagnostics(
5214                // (2,1): info CS8019: Unnecessary using directive.
5215                // using System.Collections.Generic;
5216                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Collections.Generic;"),
5217                // (3,1): info CS8019: Unnecessary using directive.
5218                // using System.Reflection;
5219                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Reflection;"),
5220                // (4,1): info CS8019: Unnecessary using directive.
5221                // using System.Linq.Expressions;
5222                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq.Expressions;"));
5223
5224            verifier.VerifyIL("AllMembers.TestLINQ",
5225@"
5226{
5227  // Code size      356 (0x164)
5228  .maxstack  4
5229  .locals init (AllMembers.<>c__DisplayClass0 V_0) //CS$<>8__locals0
5230  IL_0000:  newobj     ""AllMembers.<>c__DisplayClass0..ctor()""
5231  IL_0005:  stloc.0
5232  IL_0006:  ldloc.0
5233  IL_0007:  newobj     ""Windows.Languages.WinRTTest.IVectorInt..ctor()""
5234  IL_000c:  dup
5235  IL_000d:  ldc.i4.1
5236  IL_000e:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
5237  IL_0013:  dup
5238  IL_0014:  ldc.i4.2
5239  IL_0015:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
5240  IL_001a:  dup
5241  IL_001b:  ldc.i4.3
5242  IL_001c:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
5243  IL_0021:  dup
5244  IL_0022:  ldc.i4.4
5245  IL_0023:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
5246  IL_0028:  dup
5247  IL_0029:  ldc.i4.5
5248  IL_002a:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
5249  IL_002f:  stfld      ""Windows.Languages.WinRTTest.IVectorInt AllMembers.<>c__DisplayClass0.v""
5250  IL_0034:  ldloc.0
5251  IL_0035:  ldfld      ""Windows.Languages.WinRTTest.IVectorInt AllMembers.<>c__DisplayClass0.v""
5252  IL_003a:  callvirt   ""int System.Collections.Generic.ICollection<int>.Count.get""
5253  IL_003f:  box        ""int""
5254  IL_0044:  ldc.i4.5
5255  IL_0045:  box        ""int""
5256  IL_004a:  call       ""bool AllMembers.ValidateValue(object, object)""
5257  IL_004f:  pop
5258  IL_0050:  ldloc.0
5259  IL_0051:  ldfld      ""Windows.Languages.WinRTTest.IVectorInt AllMembers.<>c__DisplayClass0.v""
5260  IL_0056:  callvirt   ""void Windows.Languages.WinRTTest.IVectorInt.ClearFlag()""
5261  IL_005b:  ldc.i4.5
5262  IL_005c:  newarr     ""int""
5263  IL_0061:  dup
5264  IL_0062:  ldtoken    ""<PrivateImplementationDetails>.__StaticArrayInitTypeSize=20 <PrivateImplementationDetails>.$$method0x6000001-0""
5265  IL_0067:  call       ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)""
5266  IL_006c:  ldloc.0
5267  IL_006d:  ldftn      ""bool AllMembers.<>c__DisplayClass0.<TestLINQ>b__1(int)""
5268  IL_0073:  newobj     ""System.Func<int, bool>..ctor(object, System.IntPtr)""
5269  IL_0078:  call       ""System.Collections.Generic.IEnumerable<int> System.Linq.Enumerable.Where<int>(System.Collections.Generic.IEnumerable<int>, System.Func<int, bool>)""
5270  IL_007d:  call       ""System.Collections.Generic.List<int> System.Linq.Enumerable.ToList<int>(System.Collections.Generic.IEnumerable<int>)""
5271  IL_0082:  ldloc.0
5272  IL_0083:  ldfld      ""Windows.Languages.WinRTTest.IVectorInt AllMembers.<>c__DisplayClass0.v""
5273  IL_0088:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorInt.GetFlagState()""
5274  IL_008d:  ldc.i4.5
5275  IL_008e:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
5276  IL_0093:  pop
5277  IL_0094:  dup
5278  IL_0095:  call       ""int System.Linq.Enumerable.Count<int>(System.Collections.Generic.IEnumerable<int>)""
5279  IL_009a:  box        ""int""
5280  IL_009f:  ldc.i4.2
5281  IL_00a0:  box        ""int""
5282  IL_00a5:  call       ""bool AllMembers.ValidateValue(object, object)""
5283  IL_00aa:  pop
5284  IL_00ab:  dup
5285  IL_00ac:  call       ""int[] System.Linq.Enumerable.ToArray<int>(System.Collections.Generic.IEnumerable<int>)""
5286  IL_00b1:  ldc.i4.0
5287  IL_00b2:  ldelem.i4
5288  IL_00b3:  box        ""int""
5289  IL_00b8:  ldc.i4.2
5290  IL_00b9:  box        ""int""
5291  IL_00be:  call       ""bool AllMembers.ValidateValue(object, object)""
5292  IL_00c3:  pop
5293  IL_00c4:  call       ""int[] System.Linq.Enumerable.ToArray<int>(System.Collections.Generic.IEnumerable<int>)""
5294  IL_00c9:  ldc.i4.1
5295  IL_00ca:  ldelem.i4
5296  IL_00cb:  box        ""int""
5297  IL_00d0:  ldc.i4.4
5298  IL_00d1:  box        ""int""
5299  IL_00d6:  call       ""bool AllMembers.ValidateValue(object, object)""
5300  IL_00db:  pop
5301  IL_00dc:  ldloc.0
5302  IL_00dd:  ldfld      ""Windows.Languages.WinRTTest.IVectorInt AllMembers.<>c__DisplayClass0.v""
5303  IL_00e2:  ldsfld     ""System.Func<int, bool> AllMembers.CS$<>9__CachedAnonymousMethodDelegate3""
5304  IL_00e7:  dup
5305  IL_00e8:  brtrue.s   IL_00fd
5306  IL_00ea:  pop
5307  IL_00eb:  ldnull
5308  IL_00ec:  ldftn      ""bool AllMembers.<TestLINQ>b__2(object, int)""
5309  IL_00f2:  newobj     ""System.Func<int, bool>..ctor(object, System.IntPtr)""
5310  IL_00f7:  dup
5311  IL_00f8:  stsfld     ""System.Func<int, bool> AllMembers.CS$<>9__CachedAnonymousMethodDelegate3""
5312  IL_00fd:  call       ""System.Collections.Generic.IEnumerable<int> System.Linq.Enumerable.Where<int>(System.Collections.Generic.IEnumerable<int>, System.Func<int, bool>)""
5313  IL_0102:  call       ""System.Collections.Generic.List<int> System.Linq.Enumerable.ToList<int>(System.Collections.Generic.IEnumerable<int>)""
5314  IL_0107:  ldloc.0
5315  IL_0108:  ldfld      ""Windows.Languages.WinRTTest.IVectorInt AllMembers.<>c__DisplayClass0.v""
5316  IL_010d:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorInt.GetFlagState()""
5317  IL_0112:  ldc.i4.1
5318  IL_0113:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
5319  IL_0118:  pop
5320  IL_0119:  call       ""int System.Linq.Enumerable.Count<int>(System.Collections.Generic.IEnumerable<int>)""
5321  IL_011e:  box        ""int""
5322  IL_0123:  ldc.i4.2
5323  IL_0124:  box        ""int""
5324  IL_0129:  call       ""bool AllMembers.ValidateValue(object, object)""
5325  IL_012e:  pop
5326  .try
5327{
5328  IL_012f:  ldstr      ""Dev11:205875""
5329  IL_0134:  call       ""void System.Console.WriteLine(string)""
5330  IL_0139:  ldc.i4.0
5331  IL_013a:  box        ""bool""
5332  IL_013f:  ldc.i4.0
5333  IL_0140:  box        ""bool""
5334  IL_0145:  call       ""bool AllMembers.ValidateValue(object, object)""
5335  IL_014a:  pop
5336  IL_014b:  leave.s    IL_0163
5337}
5338  catch System.ArgumentException
5339{
5340  IL_014d:  ldstr      ""TestLINQ""
5341  IL_0152:  call       ""void System.Console.WriteLine(string)""
5342  IL_0157:  callvirt   ""string System.Exception.Message.get""
5343  IL_015c:  call       ""void System.Console.WriteLine(string)""
5344  IL_0161:  leave.s    IL_0163
5345}
5346  IL_0163:  ret
5347}
5348");
5349        }
5350
5351        [Fact]
5352        public void LegacyCollectionTest10()
5353        {
5354            var source =
5355@"using Windows.Languages.WinRTTest;
5356using System.Collections.Generic;
5357using System.Reflection;
5358using System.Linq.Expressions;
5359using System;
5360using System.Linq;
5361
5362class AllMembers
5363{
5364    private static int FailedCount = 0;
5365    private static bool ValidateMethod(TestMethodCalled actual, TestMethodCalled expected)
5366    {
5367        var temp = Console.ForegroundColor;
5368        if (actual != expected)
5369        {
5370            FailedCount++;
5371            Console.ForegroundColor = ConsoleColor.Red;
5372            Console.Write(""FAIL:  "");
5373        }
5374        else
5375        {
5376            Console.ForegroundColor = ConsoleColor.Green;
5377            Console.Write(""PASS:  "");
5378        }
5379
5380        Console.ForegroundColor = temp;
5381        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
5382        return actual == expected;
5383    }
5384
5385    private static bool ValidateValue(object actual, object expected)
5386    {
5387        var temp = Console.ForegroundColor;
5388        if (actual.ToString() != expected.ToString())
5389        {
5390            FailedCount++;
5391            Console.ForegroundColor = ConsoleColor.Red;
5392            Console.Write(""FAIL:  "");
5393        }
5394        else
5395        {
5396            Console.ForegroundColor = ConsoleColor.Green;
5397            Console.Write(""PASS:  "");
5398        }
5399
5400        Console.ForegroundColor = temp;
5401        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
5402        return actual.ToString() == expected.ToString();
5403    }
5404
5405    static void TestNamedArguments()
5406    {
5407        var v = new IVectorInt();
5408        v.ClearFlag();
5409        v.Add(item: 1);
5410        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Append);
5411        ValidateValue(v.Count, 1);
5412        var m = new IMapIntInt();
5413        m.ClearFlag();
5414        m.Add(key: 1, value: 1);
5415        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Insert);
5416        m.ClearFlag();
5417        m.Add(2, value: 2);
5418        ValidateMethod(m.GetFlagState(), TestMethodCalled.IMap_Insert);
5419    }
5420
5421    static int Main()
5422    {
5423        TestNamedArguments();
5424        
5425        Console.WriteLine(FailedCount);
5426        return FailedCount;
5427    }
5428}";
5429            var verifier = CompileAndVerify(source,
5430                additionalRefs: LegacyRefs,
5431                emitOptions: EmitOptions.RefEmitBug,
5432                verify: false);
5433            verifier.VerifyDiagnostics(
5434                // (2,1): info CS8019: Unnecessary using directive.
5435                // using System.Collections.Generic;
5436                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Collections.Generic;"),
5437                // (3,1): info CS8019: Unnecessary using directive.
5438                // using System.Reflection;
5439                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Reflection;"),
5440                // (4,1): info CS8019: Unnecessary using directive.
5441                // using System.Linq.Expressions;
5442                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq.Expressions;"),
5443                // (6,1): info CS8019: Unnecessary using directive.
5444                // using System.Linq;
5445                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq;"));
5446            verifier.VerifyIL("AllMembers.TestNamedArguments",
5447@"{
5448  // Code size      115 (0x73)
5449  .maxstack  4
5450  IL_0000:  newobj     ""Windows.Languages.WinRTTest.IVectorInt..ctor()""
5451  IL_0005:  dup
5452  IL_0006:  callvirt   ""void Windows.Languages.WinRTTest.IVectorInt.ClearFlag()""
5453  IL_000b:  dup
5454  IL_000c:  ldc.i4.1
5455  IL_000d:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
5456  IL_0012:  dup
5457  IL_0013:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorInt.GetFlagState()""
5458  IL_0018:  ldc.i4.s   9
5459  IL_001a:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
5460  IL_001f:  pop
5461  IL_0020:  callvirt   ""int System.Collections.Generic.ICollection<int>.Count.get""
5462  IL_0025:  box        ""int""
5463  IL_002a:  ldc.i4.1
5464  IL_002b:  box        ""int""
5465  IL_0030:  call       ""bool AllMembers.ValidateValue(object, object)""
5466  IL_0035:  pop
5467  IL_0036:  newobj     ""Windows.Languages.WinRTTest.IMapIntInt..ctor()""
5468  IL_003b:  dup
5469  IL_003c:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntInt.ClearFlag()""
5470  IL_0041:  dup
5471  IL_0042:  ldc.i4.1
5472  IL_0043:  ldc.i4.1
5473  IL_0044:  callvirt   ""void System.Collections.Generic.IDictionary<int, int>.Add(int, int)""
5474  IL_0049:  dup
5475  IL_004a:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntInt.GetFlagState()""
5476  IL_004f:  ldc.i4.s   21
5477  IL_0051:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
5478  IL_0056:  pop
5479  IL_0057:  dup
5480  IL_0058:  callvirt   ""void Windows.Languages.WinRTTest.IMapIntInt.ClearFlag()""
5481  IL_005d:  dup
5482  IL_005e:  ldc.i4.2
5483  IL_005f:  ldc.i4.2
5484  IL_0060:  callvirt   ""void System.Collections.Generic.IDictionary<int, int>.Add(int, int)""
5485  IL_0065:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IMapIntInt.GetFlagState()""
5486  IL_006a:  ldc.i4.s   21
5487  IL_006c:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
5488  IL_0071:  pop
5489  IL_0072:  ret
5490}");
5491        }
5492
5493        [Fact]
5494        public void LegacyCollectionTest11()
5495        {
5496            var source =
5497@"using Windows.Languages.WinRTTest;
5498using System.Collections.Generic;
5499using System.Reflection;
5500using System.Linq.Expressions;
5501using System;
5502using System.Linq;
5503
5504class AllMembers
5505{
5506    private static int FailedCount = 0;
5507    private static bool ValidateMethod(TestMethodCalled actual, TestMethodCalled expected)
5508    {
5509        var temp = Console.ForegroundColor;
5510        if (actual != expected)
5511        {
5512            FailedCount++;
5513            Console.ForegroundColor = ConsoleColor.Red;
5514            Console.Write(""FAIL:  "");
5515        }
5516        else
5517        {
5518            Console.ForegroundColor = ConsoleColor.Green;
5519            Console.Write(""PASS:  "");
5520        }
5521
5522        Console.ForegroundColor = temp;
5523        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
5524        return actual == expected;
5525    }
5526
5527    private static bool ValidateValue(object actual, object expected)
5528    {
5529        var temp = Console.ForegroundColor;
5530        if (actual.ToString() != expected.ToString())
5531        {
5532            FailedCount++;
5533            Console.ForegroundColor = ConsoleColor.Red;
5534            Console.Write(""FAIL:  "");
5535        }
5536        else
5537        {
5538            Console.ForegroundColor = ConsoleColor.Green;
5539            Console.Write(""PASS:  "");
5540        }
5541
5542        Console.ForegroundColor = temp;
5543        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
5544        return actual.ToString() == expected.ToString();
5545    }
5546
5547    static void TestNullableArgs()
5548    {
5549        Console.WriteLine(""===  IVectorInt - nullable ==="");
5550        var v = new IVectorInt();
5551        //Add
5552        v.ClearFlag();
5553        int? x = 1;
5554        v.Add((int)x);
5555        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Append);
5556        ValidateValue(v[0], 1);
5557    }
5558
5559    static int Main()
5560    {
5561        TestNullableArgs();
5562        
5563        Console.WriteLine(FailedCount);
5564        return FailedCount;
5565    }
5566}";
5567            var verifier = CompileAndVerify(source,
5568                additionalRefs: LegacyRefs,
5569                emitOptions: EmitOptions.RefEmitBug,
5570                verify: false);
5571            verifier.VerifyDiagnostics(
5572                // (2,1): info CS8019: Unnecessary using directive.
5573                // using System.Collections.Generic;
5574                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Collections.Generic;"),
5575                // (3,1): info CS8019: Unnecessary using directive.
5576                // using System.Reflection;
5577                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Reflection;"),
5578                // (4,1): info CS8019: Unnecessary using directive.
5579                // using System.Linq.Expressions;
5580                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq.Expressions;"),
5581                // (6,1): info CS8019: Unnecessary using directive.
5582                // using System.Linq;
5583                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq;"));
5584            verifier.VerifyIL("AllMembers.TestNullableArgs",
5585@"
5586{
5587  // Code size       80 (0x50)
5588  .maxstack  3
5589  .locals init (int? V_0) //x
5590  IL_0000:  ldstr      ""===  IVectorInt - nullable ===""
5591  IL_0005:  call       ""void System.Console.WriteLine(string)""
5592  IL_000a:  newobj     ""Windows.Languages.WinRTTest.IVectorInt..ctor()""
5593  IL_000f:  dup
5594  IL_0010:  callvirt   ""void Windows.Languages.WinRTTest.IVectorInt.ClearFlag()""
5595  IL_0015:  ldloca.s   V_0
5596  IL_0017:  ldc.i4.1
5597  IL_0018:  call       ""int?..ctor(int)""
5598  IL_001d:  dup
5599  IL_001e:  ldloca.s   V_0
5600  IL_0020:  call       ""int int?.Value.get""
5601  IL_0025:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
5602  IL_002a:  dup
5603  IL_002b:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IVectorInt.GetFlagState()""
5604  IL_0030:  ldc.i4.s   9
5605  IL_0032:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
5606  IL_0037:  pop
5607  IL_0038:  ldc.i4.0
5608  IL_0039:  callvirt   ""int System.Collections.Generic.IList<int>.this[int].get""
5609  IL_003e:  box        ""int""
5610  IL_0043:  ldc.i4.1
5611  IL_0044:  box        ""int""
5612  IL_0049:  call       ""bool AllMembers.ValidateValue(object, object)""
5613  IL_004e:  pop
5614  IL_004f:  ret
5615}
5616");
5617        }
5618
5619        [Fact]
5620        public void LegacyCollectionTest12()
5621        {
5622            var source =
5623@"using System;
5624using System.Reflection;
5625using System.Runtime.InteropServices;
5626using System.Threading;
5627using System.Collections;
5628using System.Collections.Generic;
5629using Windows.Foundation.Collections;
5630
5631namespace Test
5632{
5633    public class R : IObservableVector<int>
5634    {
5635        public event VectorChangedEventHandler<int> VectorChanged;
5636
5637        public int IndexOf(int item)
5638        {
5639            throw new NotImplementedException();
5640        }
5641
5642        public void Insert(int index, int item)
5643        {
5644            throw new NotImplementedException();
5645        }
5646
5647        public void RemoveAt(int index)
5648        {
5649            throw new NotImplementedException();
5650        }
5651
5652        int IObservableVector<int>.this[int index]
5653        {
5654            get
5655            {
5656                throw new NotImplementedException();
5657            }
5658        }
5659        int IList<int>.this[int index]
5660        {
5661            get
5662            {
5663                throw new NotImplementedException();
5664            }
5665            set
5666            {
5667                throw new NotImplementedException();
5668            }
5669        }
5670
5671        public void Add(int item)
5672        {
5673            throw new NotImplementedException();
5674        }
5675
5676        public void Clear()
5677        {
5678            throw new NotImplementedException();
5679        }
5680
5681        public bool Contains(int item)
5682        {
5683            throw new NotImplementedException();
5684        }
5685
5686        public void CopyTo(int[] array, int arrayIndex)
5687        {
5688            throw new NotImplementedException();
5689        }
5690
5691        public int Count
5692        {
5693            get { throw new NotImplementedException(); }
5694        }
5695
5696        public bool IsReadOnly
5697        {
5698            get { throw new NotImplementedException(); }
5699        }
5700
5701        public bool Remove(int item)
5702        {
5703            throw new NotImplementedException();
5704        }
5705
5706        public IEnumerator<int> GetEnumerator()
5707        {
5708            throw new NotImplementedException();
5709        }
5710        IEnumerator IEnumerable.GetEnumerator()
5711        {
5712            throw new NotImplementedException();
5713        }
5714    }
5715}";
5716            var comp = CreateCompilation(source, references: LegacyRefs);
5717            comp.VerifyDiagnostics(
5718                // (30,36): error CS0539: 'Test.R.this[int]' in explicit interface declaration is not a member of interface
5719                //         int IObservableVector<int>.this[int index]
5720                Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "this").WithArguments("Test.R.this[int]"),
5721                // (13,53): warning CS0067: The event 'Test.R.VectorChanged' is never used
5722                //         public event VectorChangedEventHandler<int> VectorChanged;
5723                Diagnostic(ErrorCode.WRN_UnreferencedEvent, "VectorChanged").WithArguments("Test.R.VectorChanged"),
5724                // (2,1): info CS8019: Unnecessary using directive.
5725                // using System.Reflection;
5726                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Reflection;"),
5727                // (3,1): info CS8019: Unnecessary using directive.
5728                // using System.Runtime.InteropServices;
5729                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Runtime.InteropServices;"),
5730                // (4,1): info CS8019: Unnecessary using directive.
5731                // using System.Threading;
5732                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Threading;"));
5733        }
5734
5735        [Fact]
5736        public void LegacyCollectionTest13()
5737        {
5738            var source =
5739@"using Windows.Languages.WinRTTest;
5740using System.Collections.Generic;
5741using System.Reflection;
5742using System.Linq.Expressions;
5743using System;
5744using System.Linq;
5745using System.Collections;
5746
5747class AllMembers
5748{
5749    private static int FailedCount = 0;
5750    private static bool ValidateMethod(TestMethodCalled actual, TestMethodCalled expected)
5751    {
5752        var temp = Console.ForegroundColor;
5753        if (actual != expected)
5754        {
5755            FailedCount++;
5756            Console.ForegroundColor = ConsoleColor.Red;
5757            Console.Write(""FAIL:  "");
5758        }
5759        else
5760        {
5761            Console.ForegroundColor = ConsoleColor.Green;
5762            Console.Write(""PASS:  "");
5763        }
5764
5765        Console.ForegroundColor = temp;
5766        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
5767        return actual == expected;
5768    }
5769
5770    static void TestIBindableVectorMembers()
5771    {
5772        Console.WriteLine(""===  IBindableVectorSimple  ==="");
5773        var v = new IBindableVectorSimple();
5774        //Add
5775        v.ClearFlag();
5776        v.Add(1);
5777        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_get_Size);
5778        //Contains
5779        v.ClearFlag();
5780        bool b = v.Contains(1);
5781        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_IndexOf);
5782        //CopyTo
5783        v.ClearFlag();
5784        int[] arr = new int[10];
5785        v.CopyTo(arr, 0);
5786        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_get_Size);
5787        //GetEnumerator
5788        v.ClearFlag();
5789        int count = v.Count;
5790        IEnumerator enumerator = ((IEnumerable)v).GetEnumerator();
5791        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableIterable_First);
5792
5793        //IndexOf
5794        v.ClearFlag();
5795        var rez = v.IndexOf(1);
5796        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_IndexOf);
5797        //Insert
5798        v.ClearFlag();
5799        v.Insert(1, 2);
5800        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_InsertAt);
5801        //IsReadOnly
5802        v.ClearFlag();
5803        bool isReadOnly = v.IsReadOnly;
5804        ValidateMethod(v.GetFlagState(), TestMethodCalled.NotSet);
5805        //Indexing
5806        v.ClearFlag();
5807        object val = v[0];
5808        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_GetAt);
5809        v.ClearFlag();
5810        val = v[1];
5811        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_GetAt);
5812        //Remove
5813        v.ClearFlag();
5814        v.Remove(1);
5815        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_IndexOf);
5816        //RemoveAt
5817        v.ClearFlag();
5818        v.RemoveAt(0);
5819        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_RemoveAt);
5820        //Clear
5821        v.Add(1);
5822        v.Add(2);
5823        v.ClearFlag();
5824        v.Clear();
5825        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_Clear);
5826    }
5827
5828    static int Main()
5829    {
5830        TestIBindableVectorMembers();
5831
5832        Console.WriteLine(FailedCount);
5833        return FailedCount;
5834    }
5835}";
5836            var verifier = CompileAndVerify(source,
5837                additionalRefs: LegacyRefs,
5838                emitOptions: EmitOptions.RefEmitBug,
5839                verify: false);
5840            verifier.VerifyDiagnostics(
5841                // (2,1): info CS8019: Unnecessary using directive.
5842                // using System.Collections.Generic;
5843                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Collections.Generic;"),
5844                // (3,1): info CS8019: Unnecessary using directive.
5845                // using System.Reflection;
5846                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Reflection;"),
5847                // (4,1): info CS8019: Unnecessary using directive.
5848                // using System.Linq.Expressions;
5849                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq.Expressions;"),
5850                // (6,1): info CS8019: Unnecessary using directive.
5851                // using System.Linq;
5852                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq;"));
5853            verifier.VerifyIL("AllMembers.TestIBindableVectorMembers",
5854@"{
5855  // Code size      410 (0x19a)
5856  .maxstack  4
5857  .locals init (int[] V_0) //arr
5858  IL_0000:  ldstr      ""===  IBindableVectorSimple  ===""
5859  IL_0005:  call       ""void System.Console.WriteLine(string)""
5860  IL_000a:  newobj     ""Windows.Languages.WinRTTest.IBindableVectorSimple..ctor()""
5861  IL_000f:  dup
5862  IL_0010:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorSimple.ClearFlag()""
5863  IL_0015:  dup
5864  IL_0016:  ldc.i4.1
5865  IL_0017:  box        ""int""
5866  IL_001c:  callvirt   ""int System.Collections.IList.Add(object)""
5867  IL_0021:  pop
5868  IL_0022:  dup
5869  IL_0023:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorSimple.GetFlagState()""
5870  IL_0028:  ldc.i4.s   28
5871  IL_002a:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
5872  IL_002f:  pop
5873  IL_0030:  dup
5874  IL_0031:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorSimple.ClearFlag()""
5875  IL_0036:  dup
5876  IL_0037:  ldc.i4.1
5877  IL_0038:  box        ""int""
5878  IL_003d:  callvirt   ""bool System.Collections.IList.Contains(object)""
5879  IL_0042:  pop
5880  IL_0043:  dup
5881  IL_0044:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorSimple.GetFlagState()""
5882  IL_0049:  ldc.i4.s   30
5883  IL_004b:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
5884  IL_0050:  pop
5885  IL_0051:  dup
5886  IL_0052:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorSimple.ClearFlag()""
5887  IL_0057:  ldc.i4.s   10
5888  IL_0059:  newarr     ""int""
5889  IL_005e:  stloc.0
5890  IL_005f:  dup
5891  IL_0060:  ldloc.0
5892  IL_0061:  ldc.i4.0
5893  IL_0062:  callvirt   ""void System.Collections.ICollection.CopyTo(System.Array, int)""
5894  IL_0067:  dup
5895  IL_0068:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorSimple.GetFlagState()""
5896  IL_006d:  ldc.i4.s   28
5897  IL_006f:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
5898  IL_0074:  pop
5899  IL_0075:  dup
5900  IL_0076:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorSimple.ClearFlag()""
5901  IL_007b:  dup
5902  IL_007c:  callvirt   ""int System.Collections.ICollection.Count.get""
5903  IL_0081:  pop
5904  IL_0082:  dup
5905  IL_0083:  callvirt   ""System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()""
5906  IL_0088:  pop
5907  IL_0089:  dup
5908  IL_008a:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorSimple.GetFlagState()""
5909  IL_008f:  ldc.i4.s   26
5910  IL_0091:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
5911  IL_0096:  pop
5912  IL_0097:  dup
5913  IL_0098:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorSimple.ClearFlag()""
5914  IL_009d:  dup
5915  IL_009e:  ldc.i4.1
5916  IL_009f:  box        ""int""
5917  IL_00a4:  callvirt   ""int System.Collections.IList.IndexOf(object)""
5918  IL_00a9:  pop
5919  IL_00aa:  dup
5920  IL_00ab:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorSimple.GetFlagState()""
5921  IL_00b0:  ldc.i4.s   30
5922  IL_00b2:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
5923  IL_00b7:  pop
5924  IL_00b8:  dup
5925  IL_00b9:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorSimple.ClearFlag()""
5926  IL_00be:  dup
5927  IL_00bf:  ldc.i4.1
5928  IL_00c0:  ldc.i4.2
5929  IL_00c1:  box        ""int""
5930  IL_00c6:  callvirt   ""void System.Collections.IList.Insert(int, object)""
5931  IL_00cb:  dup
5932  IL_00cc:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorSimple.GetFlagState()""
5933  IL_00d1:  ldc.i4.s   32
5934  IL_00d3:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
5935  IL_00d8:  pop
5936  IL_00d9:  dup
5937  IL_00da:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorSimple.ClearFlag()""
5938  IL_00df:  dup
5939  IL_00e0:  callvirt   ""bool System.Collections.IList.IsReadOnly.get""
5940  IL_00e5:  pop
5941  IL_00e6:  dup
5942  IL_00e7:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorSimple.GetFlagState()""
5943  IL_00ec:  ldc.i4.0
5944  IL_00ed:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
5945  IL_00f2:  pop
5946  IL_00f3:  dup
5947  IL_00f4:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorSimple.ClearFlag()""
5948  IL_00f9:  dup
5949  IL_00fa:  ldc.i4.0
5950  IL_00fb:  callvirt   ""object System.Collections.IList.this[int].get""
5951  IL_0100:  pop
5952  IL_0101:  dup
5953  IL_0102:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorSimple.GetFlagState()""
5954  IL_0107:  ldc.i4.s   27
5955  IL_0109:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
5956  IL_010e:  pop
5957  IL_010f:  dup
5958  IL_0110:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorSimple.ClearFlag()""
5959  IL_0115:  dup
5960  IL_0116:  ldc.i4.1
5961  IL_0117:  callvirt   ""object System.Collections.IList.this[int].get""
5962  IL_011c:  pop
5963  IL_011d:  dup
5964  IL_011e:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorSimple.GetFlagState()""
5965  IL_0123:  ldc.i4.s   27
5966  IL_0125:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
5967  IL_012a:  pop
5968  IL_012b:  dup
5969  IL_012c:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorSimple.ClearFlag()""
5970  IL_0131:  dup
5971  IL_0132:  ldc.i4.1
5972  IL_0133:  box        ""int""
5973  IL_0138:  callvirt   ""void System.Collections.IList.Remove(object)""
5974  IL_013d:  dup
5975  IL_013e:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorSimple.GetFlagState()""
5976  IL_0143:  ldc.i4.s   30
5977  IL_0145:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
5978  IL_014a:  pop
5979  IL_014b:  dup
5980  IL_014c:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorSimple.ClearFlag()""
5981  IL_0151:  dup
5982  IL_0152:  ldc.i4.0
5983  IL_0153:  callvirt   ""void System.Collections.IList.RemoveAt(int)""
5984  IL_0158:  dup
5985  IL_0159:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorSimple.GetFlagState()""
5986  IL_015e:  ldc.i4.s   33
5987  IL_0160:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
5988  IL_0165:  pop
5989  IL_0166:  dup
5990  IL_0167:  ldc.i4.1
5991  IL_0168:  box        ""int""
5992  IL_016d:  callvirt   ""int System.Collections.IList.Add(object)""
5993  IL_0172:  pop
5994  IL_0173:  dup
5995  IL_0174:  ldc.i4.2
5996  IL_0175:  box        ""int""
5997  IL_017a:  callvirt   ""int System.Collections.IList.Add(object)""
5998  IL_017f:  pop
5999  IL_0180:  dup
6000  IL_0181:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorSimple.ClearFlag()""
6001  IL_0186:  dup
6002  IL_0187:  callvirt   ""void System.Collections.IList.Clear()""
6003  IL_018c:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorSimple.GetFlagState()""
6004  IL_0191:  ldc.i4.s   36
6005  IL_0193:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6006  IL_0198:  pop
6007  IL_0199:  ret
6008}");
6009        }
6010
6011        [Fact]
6012        public void LegacyCollectionTest14()
6013        {
6014            var source =
6015@"using Windows.Languages.WinRTTest;
6016using System.Collections.Generic;
6017using System.Reflection;
6018using System.Linq.Expressions;
6019using System;
6020using System.Linq;
6021using System.Collections;
6022
6023class AllMembers
6024{
6025    private static int FailedCount = 0;
6026    private static bool ValidateMethod(TestMethodCalled actual, TestMethodCalled expected)
6027    {
6028        var temp = Console.ForegroundColor;
6029        if (actual != expected)
6030        {
6031            FailedCount++;
6032            Console.ForegroundColor = ConsoleColor.Red;
6033            Console.Write(""FAIL:  "");
6034        }
6035        else
6036        {
6037            Console.ForegroundColor = ConsoleColor.Green;
6038            Console.Write(""PASS:  "");
6039        }
6040
6041        Console.ForegroundColor = temp;
6042        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
6043        return actual == expected;
6044    }
6045
6046    static void TestIBindableIterableMembers()
6047    {
6048        Console.WriteLine(""===  IBindableIterableSimple  ==="");
6049        var v = new IBindableIterableSimple();
6050        //Add
6051        v.ClearFlag();
6052        v.GetEnumerator();
6053        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableIterable_First);
6054    }
6055
6056    static int Main()
6057    {
6058        TestIBindableIterableMembers();
6059
6060        Console.WriteLine(FailedCount);
6061        return FailedCount;
6062    }
6063}";
6064            var verifier = CompileAndVerify(source,
6065                additionalRefs: LegacyRefs,
6066                emitOptions: EmitOptions.RefEmitBug,
6067                verify: false);
6068            verifier.VerifyDiagnostics(
6069                // (2,1): info CS8019: Unnecessary using directive.
6070                // using System.Collections.Generic;
6071                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Collections.Generic;"),
6072                // (3,1): info CS8019: Unnecessary using directive.
6073                // using System.Reflection;
6074                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Reflection;"),
6075                // (4,1): info CS8019: Unnecessary using directive.
6076                // using System.Linq.Expressions;
6077                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq.Expressions;"),
6078                // (6,1): info CS8019: Unnecessary using directive.
6079                // using System.Linq;
6080                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq;"),
6081                // (7,1): info CS8019: Unnecessary using directive.
6082                // using System.Collections;
6083                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Collections;"));
6084            verifier.VerifyIL("AllMembers.TestIBindableIterableMembers",
6085@"{
6086  // Code size       42 (0x2a)
6087  .maxstack  2
6088  IL_0000:  ldstr      ""===  IBindableIterableSimple  ===""
6089  IL_0005:  call       ""void System.Console.WriteLine(string)""
6090  IL_000a:  newobj     ""Windows.Languages.WinRTTest.IBindableIterableSimple..ctor()""
6091  IL_000f:  dup
6092  IL_0010:  callvirt   ""void Windows.Languages.WinRTTest.IBindableIterableSimple.ClearFlag()""
6093  IL_0015:  dup
6094  IL_0016:  callvirt   ""System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()""
6095  IL_001b:  pop
6096  IL_001c:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableIterableSimple.GetFlagState()""
6097  IL_0021:  ldc.i4.s   26
6098  IL_0023:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6099  IL_0028:  pop
6100  IL_0029:  ret
6101}");
6102        }
6103
6104        [Fact]
6105        public void LegacyCollectionTest15()
6106        {
6107            var source =
6108@"using Windows.Languages.WinRTTest;
6109using System.Collections.Generic;
6110using System.Reflection;
6111using System.Linq.Expressions;
6112using System;
6113using System.Linq;
6114using System.Collections;
6115
6116class AllMembers
6117{
6118    private static int FailedCount = 0;
6119    private static bool ValidateMethod(TestMethodCalled actual, TestMethodCalled expected)
6120    {
6121        var temp = Console.ForegroundColor;
6122        if (actual != expected)
6123        {
6124            FailedCount++;
6125            Console.ForegroundColor = ConsoleColor.Red;
6126            Console.Write(""FAIL:  "");
6127        }
6128        else
6129        {
6130            Console.ForegroundColor = ConsoleColor.Green;
6131            Console.Write(""PASS:  "");
6132        }
6133
6134        Console.ForegroundColor = temp;
6135        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
6136        return actual == expected;
6137    }
6138
6139    static void TestIBindableVectorIVectorIntMembers()
6140    {
6141        Console.WriteLine(""===  IBindableVectorIVectorIntSimple  ==="");
6142        var v = new IBindableVectorIVectorInt();
6143
6144        //Validate IBindableVector
6145
6146        //Add
6147        v.ClearFlag();
6148        v.Add((object)1);
6149        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_get_Size);
6150        //Contains
6151        v.ClearFlag();
6152        bool b = v.Contains((object)1);
6153        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_IndexOf);
6154        //CopyTo
6155        v.ClearFlag();
6156        int[] arr = new int[10];
6157        v.CopyTo(arr, 0);
6158        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_get_Size);
6159        //GetEnumerator
6160        v.ClearFlag();
6161        int count = ((IList)v).Count;
6162        IEnumerator enumerator = ((IEnumerable)v).GetEnumerator();
6163        ValidateMethod(v.GetFlagState(), TestMethodCalled.IIterable_First);
6164
6165        //IndexOf
6166        v.ClearFlag();
6167        var rez = v.IndexOf((object)1);
6168        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_IndexOf);
6169        //Insert
6170        v.ClearFlag();
6171        v.Insert(1, (object)2);
6172        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_InsertAt);
6173        //IsReadOnly
6174        v.ClearFlag();
6175        bool isReadOnly = ((IList)v).IsReadOnly;
6176        ValidateMethod(v.GetFlagState(), TestMethodCalled.NotSet);
6177        //Indexing
6178        v.ClearFlag();
6179        object val = ((IList)v)[0];
6180        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_GetAt);
6181        v.ClearFlag();
6182        val = ((IList)v)[1];
6183        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_GetAt);
6184        //Remove
6185        v.ClearFlag();
6186        v.Remove((object)1);
6187        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_IndexOf);
6188        //RemoveAt
6189        v.ClearFlag();
6190        ((IList)v).RemoveAt(0);
6191        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_RemoveAt);
6192        //Clear
6193        v.Add(1);
6194        v.Add(2);
6195        v.ClearFlag();
6196        ((IList)v).Clear();
6197        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_Clear);
6198
6199
6200        //Validate Vector<int>
6201        //Add
6202        v.ClearFlag();
6203        v.Add(1);
6204        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_Append);
6205        //Contains
6206        v.ClearFlag();
6207        b = v.Contains(1);
6208        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
6209        //CopyTo
6210        v.ClearFlag();
6211        arr = new int[10];
6212        v.CopyTo(arr, 0);
6213        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_get_Size);
6214        //GetEnumerator
6215        v.ClearFlag();
6216        count = ((IList<int>)v).Count;
6217        IEnumerator<int> enumerator2 = ((IList<int>)v).GetEnumerator();
6218        ValidateMethod(v.GetFlagState(), TestMethodCalled.IIterable_First);
6219
6220        //IndexOf
6221        v.ClearFlag();
6222        rez = v.IndexOf(1);
6223        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
6224        //Insert
6225        v.ClearFlag();
6226        v.Insert(1, 2);
6227        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_InsertAt);
6228        //IsReadOnly
6229        v.ClearFlag();
6230        isReadOnly = ((IList<int>)v).IsReadOnly;
6231        ValidateMethod(v.GetFlagState(), TestMethodCalled.NotSet);
6232        //Indexing
6233        v.ClearFlag();
6234        val = ((IList<int>)v)[0];
6235        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
6236        v.ClearFlag();
6237        val = ((IList<int>)v)[1];
6238        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_GetAt);
6239        //Remove
6240        v.ClearFlag();
6241        v.Remove(1);
6242        ValidateMethod(v.GetFlagState(), TestMethodCalled.IVector_IndexOf);
6243        //RemoveAt
6244        v.ClearFlag();
6245        ((IList<int>)v).RemoveAt(0);
6246        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_RemoveAt);
6247        //Clear
6248        v.Add(1);
6249        v.Add(2);
6250        v.ClearFlag();
6251        ((IList<int>)v).Clear();
6252        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_Clear);
6253
6254    }
6255
6256    static int Main()
6257    {
6258        TestIBindableVectorIVectorIntMembers();
6259
6260        Console.WriteLine(FailedCount);
6261        return FailedCount;
6262    }
6263}";
6264            var verifier = CompileAndVerify(source,
6265                additionalRefs: LegacyRefs,
6266                emitOptions: EmitOptions.RefEmitBug,
6267                verify:false);
6268            verifier.VerifyDiagnostics(
6269                // (3,1): info CS8019: Unnecessary using directive.
6270                // using System.Reflection;
6271                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Reflection;"),
6272                // (4,1): info CS8019: Unnecessary using directive.
6273                // using System.Linq.Expressions;
6274                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq.Expressions;"),
6275                // (6,1): info CS8019: Unnecessary using directive.
6276                // using System.Linq;
6277                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq;"));
6278            verifier.VerifyIL("AllMembers.TestIBindableVectorIVectorIntMembers",
6279@"
6280{
6281  // Code size      748 (0x2ec)
6282  .maxstack  4
6283  .locals init (int[] V_0) //arr
6284  IL_0000:  ldstr      ""===  IBindableVectorIVectorIntSimple  ===""
6285  IL_0005:  call       ""void System.Console.WriteLine(string)""
6286  IL_000a:  newobj     ""Windows.Languages.WinRTTest.IBindableVectorIVectorInt..ctor()""
6287  IL_000f:  dup
6288  IL_0010:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6289  IL_0015:  dup
6290  IL_0016:  ldc.i4.1
6291  IL_0017:  box        ""int""
6292  IL_001c:  callvirt   ""int System.Collections.IList.Add(object)""
6293  IL_0021:  pop
6294  IL_0022:  dup
6295  IL_0023:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6296  IL_0028:  ldc.i4.s   28
6297  IL_002a:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6298  IL_002f:  pop
6299  IL_0030:  dup
6300  IL_0031:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6301  IL_0036:  dup
6302  IL_0037:  ldc.i4.1
6303  IL_0038:  box        ""int""
6304  IL_003d:  callvirt   ""bool System.Collections.IList.Contains(object)""
6305  IL_0042:  pop
6306  IL_0043:  dup
6307  IL_0044:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6308  IL_0049:  ldc.i4.s   30
6309  IL_004b:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6310  IL_0050:  pop
6311  IL_0051:  dup
6312  IL_0052:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6313  IL_0057:  ldc.i4.s   10
6314  IL_0059:  newarr     ""int""
6315  IL_005e:  stloc.0
6316  IL_005f:  dup
6317  IL_0060:  ldloc.0
6318  IL_0061:  ldc.i4.0
6319  IL_0062:  callvirt   ""void System.Collections.Generic.ICollection<int>.CopyTo(int[], int)""
6320  IL_0067:  dup
6321  IL_0068:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6322  IL_006d:  ldc.i4.s   28
6323  IL_006f:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6324  IL_0074:  pop
6325  IL_0075:  dup
6326  IL_0076:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6327  IL_007b:  dup
6328  IL_007c:  callvirt   ""int System.Collections.ICollection.Count.get""
6329  IL_0081:  pop
6330  IL_0082:  dup
6331  IL_0083:  callvirt   ""System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()""
6332  IL_0088:  pop
6333  IL_0089:  dup
6334  IL_008a:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6335  IL_008f:  ldc.i4.1
6336  IL_0090:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6337  IL_0095:  pop
6338  IL_0096:  dup
6339  IL_0097:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6340  IL_009c:  dup
6341  IL_009d:  ldc.i4.1
6342  IL_009e:  box        ""int""
6343  IL_00a3:  callvirt   ""int System.Collections.IList.IndexOf(object)""
6344  IL_00a8:  pop
6345  IL_00a9:  dup
6346  IL_00aa:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6347  IL_00af:  ldc.i4.s   30
6348  IL_00b1:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6349  IL_00b6:  pop
6350  IL_00b7:  dup
6351  IL_00b8:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6352  IL_00bd:  dup
6353  IL_00be:  ldc.i4.1
6354  IL_00bf:  ldc.i4.2
6355  IL_00c0:  box        ""int""
6356  IL_00c5:  callvirt   ""void System.Collections.IList.Insert(int, object)""
6357  IL_00ca:  dup
6358  IL_00cb:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6359  IL_00d0:  ldc.i4.s   32
6360  IL_00d2:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6361  IL_00d7:  pop
6362  IL_00d8:  dup
6363  IL_00d9:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6364  IL_00de:  dup
6365  IL_00df:  callvirt   ""bool System.Collections.IList.IsReadOnly.get""
6366  IL_00e4:  pop
6367  IL_00e5:  dup
6368  IL_00e6:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6369  IL_00eb:  ldc.i4.0
6370  IL_00ec:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6371  IL_00f1:  pop
6372  IL_00f2:  dup
6373  IL_00f3:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6374  IL_00f8:  dup
6375  IL_00f9:  ldc.i4.0
6376  IL_00fa:  callvirt   ""object System.Collections.IList.this[int].get""
6377  IL_00ff:  pop
6378  IL_0100:  dup
6379  IL_0101:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6380  IL_0106:  ldc.i4.s   27
6381  IL_0108:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6382  IL_010d:  pop
6383  IL_010e:  dup
6384  IL_010f:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6385  IL_0114:  dup
6386  IL_0115:  ldc.i4.1
6387  IL_0116:  callvirt   ""object System.Collections.IList.this[int].get""
6388  IL_011b:  pop
6389  IL_011c:  dup
6390  IL_011d:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6391  IL_0122:  ldc.i4.s   27
6392  IL_0124:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6393  IL_0129:  pop
6394  IL_012a:  dup
6395  IL_012b:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6396  IL_0130:  dup
6397  IL_0131:  ldc.i4.1
6398  IL_0132:  box        ""int""
6399  IL_0137:  callvirt   ""void System.Collections.IList.Remove(object)""
6400  IL_013c:  dup
6401  IL_013d:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6402  IL_0142:  ldc.i4.s   30
6403  IL_0144:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6404  IL_0149:  pop
6405  IL_014a:  dup
6406  IL_014b:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6407  IL_0150:  dup
6408  IL_0151:  ldc.i4.0
6409  IL_0152:  callvirt   ""void System.Collections.IList.RemoveAt(int)""
6410  IL_0157:  dup
6411  IL_0158:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6412  IL_015d:  ldc.i4.s   33
6413  IL_015f:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6414  IL_0164:  pop
6415  IL_0165:  dup
6416  IL_0166:  ldc.i4.1
6417  IL_0167:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
6418  IL_016c:  dup
6419  IL_016d:  ldc.i4.2
6420  IL_016e:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
6421  IL_0173:  dup
6422  IL_0174:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6423  IL_0179:  dup
6424  IL_017a:  callvirt   ""void System.Collections.IList.Clear()""
6425  IL_017f:  dup
6426  IL_0180:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6427  IL_0185:  ldc.i4.s   36
6428  IL_0187:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6429  IL_018c:  pop
6430  IL_018d:  dup
6431  IL_018e:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6432  IL_0193:  dup
6433  IL_0194:  ldc.i4.1
6434  IL_0195:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
6435  IL_019a:  dup
6436  IL_019b:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6437  IL_01a0:  ldc.i4.s   9
6438  IL_01a2:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6439  IL_01a7:  pop
6440  IL_01a8:  dup
6441  IL_01a9:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6442  IL_01ae:  dup
6443  IL_01af:  ldc.i4.1
6444  IL_01b0:  callvirt   ""bool System.Collections.Generic.ICollection<int>.Contains(int)""
6445  IL_01b5:  pop
6446  IL_01b6:  dup
6447  IL_01b7:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6448  IL_01bc:  ldc.i4.5
6449  IL_01bd:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6450  IL_01c2:  pop
6451  IL_01c3:  dup
6452  IL_01c4:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6453  IL_01c9:  ldc.i4.s   10
6454  IL_01cb:  newarr     ""int""
6455  IL_01d0:  stloc.0
6456  IL_01d1:  dup
6457  IL_01d2:  ldloc.0
6458  IL_01d3:  ldc.i4.0
6459  IL_01d4:  callvirt   ""void System.Collections.Generic.ICollection<int>.CopyTo(int[], int)""
6460  IL_01d9:  dup
6461  IL_01da:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6462  IL_01df:  ldc.i4.s   28
6463  IL_01e1:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6464  IL_01e6:  pop
6465  IL_01e7:  dup
6466  IL_01e8:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6467  IL_01ed:  dup
6468  IL_01ee:  callvirt   ""int System.Collections.Generic.ICollection<int>.Count.get""
6469  IL_01f3:  pop
6470  IL_01f4:  dup
6471  IL_01f5:  callvirt   ""System.Collections.Generic.IEnumerator<int> System.Collections.Generic.IEnumerable<int>.GetEnumerator()""
6472  IL_01fa:  pop
6473  IL_01fb:  dup
6474  IL_01fc:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6475  IL_0201:  ldc.i4.1
6476  IL_0202:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6477  IL_0207:  pop
6478  IL_0208:  dup
6479  IL_0209:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6480  IL_020e:  dup
6481  IL_020f:  ldc.i4.1
6482  IL_0210:  callvirt   ""int System.Collections.Generic.IList<int>.IndexOf(int)""
6483  IL_0215:  pop
6484  IL_0216:  dup
6485  IL_0217:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6486  IL_021c:  ldc.i4.5
6487  IL_021d:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6488  IL_0222:  pop
6489  IL_0223:  dup
6490  IL_0224:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6491  IL_0229:  dup
6492  IL_022a:  ldc.i4.1
6493  IL_022b:  ldc.i4.2
6494  IL_022c:  callvirt   ""void System.Collections.Generic.IList<int>.Insert(int, int)""
6495  IL_0231:  dup
6496  IL_0232:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6497  IL_0237:  ldc.i4.7
6498  IL_0238:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6499  IL_023d:  pop
6500  IL_023e:  dup
6501  IL_023f:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6502  IL_0244:  dup
6503  IL_0245:  callvirt   ""bool System.Collections.Generic.ICollection<int>.IsReadOnly.get""
6504  IL_024a:  pop
6505  IL_024b:  dup
6506  IL_024c:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6507  IL_0251:  ldc.i4.0
6508  IL_0252:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6509  IL_0257:  pop
6510  IL_0258:  dup
6511  IL_0259:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6512  IL_025e:  dup
6513  IL_025f:  ldc.i4.0
6514  IL_0260:  callvirt   ""int System.Collections.Generic.IList<int>.this[int].get""
6515  IL_0265:  pop
6516  IL_0266:  dup
6517  IL_0267:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6518  IL_026c:  ldc.i4.2
6519  IL_026d:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6520  IL_0272:  pop
6521  IL_0273:  dup
6522  IL_0274:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6523  IL_0279:  dup
6524  IL_027a:  ldc.i4.1
6525  IL_027b:  callvirt   ""int System.Collections.Generic.IList<int>.this[int].get""
6526  IL_0280:  pop
6527  IL_0281:  dup
6528  IL_0282:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6529  IL_0287:  ldc.i4.2
6530  IL_0288:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6531  IL_028d:  pop
6532  IL_028e:  dup
6533  IL_028f:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6534  IL_0294:  dup
6535  IL_0295:  ldc.i4.1
6536  IL_0296:  callvirt   ""bool System.Collections.Generic.ICollection<int>.Remove(int)""
6537  IL_029b:  pop
6538  IL_029c:  dup
6539  IL_029d:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6540  IL_02a2:  ldc.i4.5
6541  IL_02a3:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6542  IL_02a8:  pop
6543  IL_02a9:  dup
6544  IL_02aa:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6545  IL_02af:  dup
6546  IL_02b0:  ldc.i4.0
6547  IL_02b1:  callvirt   ""void System.Collections.Generic.IList<int>.RemoveAt(int)""
6548  IL_02b6:  dup
6549  IL_02b7:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6550  IL_02bc:  ldc.i4.s   33
6551  IL_02be:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6552  IL_02c3:  pop
6553  IL_02c4:  dup
6554  IL_02c5:  ldc.i4.1
6555  IL_02c6:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
6556  IL_02cb:  dup
6557  IL_02cc:  ldc.i4.2
6558  IL_02cd:  callvirt   ""void System.Collections.Generic.ICollection<int>.Add(int)""
6559  IL_02d2:  dup
6560  IL_02d3:  callvirt   ""void Windows.Languages.WinRTTest.IBindableVectorIVectorInt.ClearFlag()""
6561  IL_02d8:  dup
6562  IL_02d9:  callvirt   ""void System.Collections.Generic.ICollection<int>.Clear()""
6563  IL_02de:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableVectorIVectorInt.GetFlagState()""
6564  IL_02e3:  ldc.i4.s   36
6565  IL_02e5:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6566  IL_02ea:  pop
6567  IL_02eb:  ret
6568}");
6569        }
6570
6571        [Fact]
6572        public void LegacyCollectionTest16()
6573        {
6574            var source =
6575@"using Windows.Languages.WinRTTest;
6576using System.Collections.Generic;
6577using System.Reflection;
6578using System.Linq.Expressions;
6579using System;
6580using System.Linq;
6581using System.Collections;
6582
6583class AllMembers
6584{
6585    private static int FailedCount = 0;
6586    private static bool ValidateMethod(TestMethodCalled actual, TestMethodCalled expected)
6587    {
6588        var temp = Console.ForegroundColor;
6589        if (actual != expected)
6590        {
6591            FailedCount++;
6592            Console.ForegroundColor = ConsoleColor.Red;
6593            Console.Write(""FAIL:  "");
6594        }
6595        else
6596        {
6597            Console.ForegroundColor = ConsoleColor.Green;
6598            Console.Write(""PASS:  "");
6599        }
6600
6601        Console.ForegroundColor = temp;
6602        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
6603        return actual == expected;
6604    }
6605
6606    static void TestIBindableIterableIIterableMembers()
6607    {
6608        Console.WriteLine(""===  IBindableIterableIIterable  ==="");
6609        var v = new IBindableIterableIIterable();
6610        //Add
6611        v.ClearFlag();
6612        ((IEnumerable)v).GetEnumerator();
6613        ValidateMethod(v.GetFlagState(), TestMethodCalled.IIterable_First);
6614    }
6615
6616    static int Main()
6617    {
6618        TestIBindableIterableIIterableMembers();
6619
6620        Console.WriteLine(FailedCount);
6621        return FailedCount;
6622    }
6623}";
6624            var verifier = CompileAndVerify(source,
6625                additionalRefs: LegacyRefs,
6626                emitOptions: EmitOptions.RefEmitBug,
6627                verify: false);
6628            verifier.VerifyDiagnostics(
6629                // (2,1): info CS8019: Unnecessary using directive.
6630                // using System.Collections.Generic;
6631                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Collections.Generic;"),
6632                // (3,1): info CS8019: Unnecessary using directive.
6633                // using System.Reflection;
6634                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Reflection;"),
6635                // (4,1): info CS8019: Unnecessary using directive.
6636                // using System.Linq.Expressions;
6637                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq.Expressions;"),
6638                // (6,1): info CS8019: Unnecessary using directive.
6639                // using System.Linq;
6640                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq;"));
6641            verifier.VerifyIL("AllMembers.TestIBindableIterableIIterableMembers",
6642@"{
6643  // Code size       41 (0x29)
6644  .maxstack  2
6645  IL_0000:  ldstr      ""===  IBindableIterableIIterable  ===""
6646  IL_0005:  call       ""void System.Console.WriteLine(string)""
6647  IL_000a:  newobj     ""Windows.Languages.WinRTTest.IBindableIterableIIterable..ctor()""
6648  IL_000f:  dup
6649  IL_0010:  callvirt   ""void Windows.Languages.WinRTTest.IBindableIterableIIterable.ClearFlag()""
6650  IL_0015:  dup
6651  IL_0016:  callvirt   ""System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()""
6652  IL_001b:  pop
6653  IL_001c:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.IBindableIterableIIterable.GetFlagState()""
6654  IL_0021:  ldc.i4.1
6655  IL_0022:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6656  IL_0027:  pop
6657  IL_0028:  ret
6658}");
6659        }
6660
6661        [Fact]
6662        public void LegacyCollectionTest17()
6663        {
6664            var source =
6665@"using Windows.Languages.WinRTTest;
6666using System.Collections.Generic;
6667using System.Reflection;
6668using System.Linq.Expressions;
6669using System;
6670using System.Linq;
6671using System.Collections;
6672
6673class AllMembers
6674{
6675    private static int FailedCount = 0;
6676    private static bool ValidateMethod(TestMethodCalled actual, TestMethodCalled expected)
6677    {
6678        var temp = Console.ForegroundColor;
6679        if (actual != expected)
6680        {
6681            FailedCount++;
6682            Console.ForegroundColor = ConsoleColor.Red;
6683            Console.Write(""FAIL:  "");
6684        }
6685        else
6686        {
6687            Console.ForegroundColor = ConsoleColor.Green;
6688            Console.Write(""PASS:  "");
6689        }
6690
6691        Console.ForegroundColor = temp;
6692        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
6693        return actual == expected;
6694    }
6695
6696    static void INotifyCollectionAndBindableVectorMembers()
6697    {
6698        Console.WriteLine(""===  INotifyCollectionAndBindableVectorClass  ==="");
6699        var v = new INotifyCollectionAndBindableVectorClass();
6700        //Add
6701        v.ClearFlag();
6702        v.Add(1);
6703        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_get_Size);
6704        //Contains
6705        v.ClearFlag();
6706        bool b = v.Contains(1);
6707        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_IndexOf);
6708        //CopyTo
6709        v.ClearFlag();
6710        int[] arr = new int[10];
6711        v.CopyTo(arr, 0);
6712        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_get_Size);
6713        //GetEnumerator
6714        v.ClearFlag();
6715        int count = v.Count;
6716        IEnumerator enumerator = ((IEnumerable)v).GetEnumerator();
6717        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableIterable_First);
6718
6719        //IndexOf
6720        v.ClearFlag();
6721        var rez = v.IndexOf(1);
6722        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_IndexOf);
6723        //Insert
6724        v.ClearFlag();
6725        v.Insert(1, 2);
6726        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_InsertAt);
6727        //IsReadOnly
6728        v.ClearFlag();
6729        bool isReadOnly = v.IsReadOnly;
6730        ValidateMethod(v.GetFlagState(), TestMethodCalled.NotSet);
6731        //Indexing
6732        v.ClearFlag();
6733        object val = v[0];
6734        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_GetAt);
6735        v.ClearFlag();
6736        val = v[1];
6737        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_GetAt);
6738        //Remove
6739        v.ClearFlag();
6740        v.Remove(1);
6741        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_IndexOf);
6742        //RemoveAt
6743        v.ClearFlag();
6744        v.RemoveAt(0);
6745        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_RemoveAt);
6746        //Clear
6747        v.Add(1);
6748        v.Add(2);
6749        v.ClearFlag();
6750        v.Clear();
6751        ValidateMethod(v.GetFlagState(), TestMethodCalled.IBindableVector_Clear);
6752
6753
6754        //Events
6755        //Add event
6756        v.ClearFlag();
6757        var dele = new System.Collections.Specialized.NotifyCollectionChangedEventHandler(v_CollectionChanged);
6758        v.CollectionChanged += dele;
6759        ValidateMethod(v.GetFlagState(), TestMethodCalled.INotifyCollectionChanged_Add_CollectionChanged);
6760
6761        //Remove event
6762        v.ClearFlag();
6763        v.CollectionChanged -= dele;
6764        ValidateMethod(v.GetFlagState(), TestMethodCalled.INotifyCollectionChanged_Remove_CollectionChanged);
6765    }
6766
6767    static void v_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
6768    {
6769        throw new NotImplementedException();
6770    }
6771
6772    static void v_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
6773    {
6774        throw new NotImplementedException();
6775    }
6776
6777    static int Main()
6778    {
6779        INotifyCollectionAndBindableVectorMembers();
6780
6781        Console.WriteLine(FailedCount);
6782        return FailedCount;
6783    }
6784}";
6785            var verifier = CompileAndVerify(
6786                source,
6787                additionalRefs: LegacyRefs,
6788                emitOptions: EmitOptions.RefEmitBug,
6789                verify: false);
6790            verifier.VerifyDiagnostics(
6791                // (2,1): info CS8019: Unnecessary using directive.
6792                // using System.Collections.Generic;
6793                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Collections.Generic;"),
6794                // (3,1): info CS8019: Unnecessary using directive.
6795                // using System.Reflection;
6796                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Reflection;"),
6797                // (4,1): info CS8019: Unnecessary using directive.
6798                // using System.Linq.Expressions;
6799                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq.Expressions;"),
6800                // (6,1): info CS8019: Unnecessary using directive.
6801                // using System.Linq;
6802                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq;"));
6803            verifier.VerifyIL("AllMembers.INotifyCollectionAndBindableVectorMembers",
6804@"
6805{
6806  // Code size      477 (0x1dd)
6807  .maxstack  4
6808  .locals init (int[] V_0, //arr
6809  System.Collections.Specialized.NotifyCollectionChangedEventHandler V_1) //dele
6810  IL_0000:  ldstr      ""===  INotifyCollectionAndBindableVectorClass  ===""
6811  IL_0005:  call       ""void System.Console.WriteLine(string)""
6812  IL_000a:  newobj     ""Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass..ctor()""
6813  IL_000f:  dup
6814  IL_0010:  callvirt   ""void Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.ClearFlag()""
6815  IL_0015:  dup
6816  IL_0016:  ldc.i4.1
6817  IL_0017:  box        ""int""
6818  IL_001c:  callvirt   ""int System.Collections.IList.Add(object)""
6819  IL_0021:  pop
6820  IL_0022:  dup
6821  IL_0023:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.GetFlagState()""
6822  IL_0028:  ldc.i4.s   28
6823  IL_002a:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6824  IL_002f:  pop
6825  IL_0030:  dup
6826  IL_0031:  callvirt   ""void Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.ClearFlag()""
6827  IL_0036:  dup
6828  IL_0037:  ldc.i4.1
6829  IL_0038:  box        ""int""
6830  IL_003d:  callvirt   ""bool System.Collections.IList.Contains(object)""
6831  IL_0042:  pop
6832  IL_0043:  dup
6833  IL_0044:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.GetFlagState()""
6834  IL_0049:  ldc.i4.s   30
6835  IL_004b:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6836  IL_0050:  pop
6837  IL_0051:  dup
6838  IL_0052:  callvirt   ""void Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.ClearFlag()""
6839  IL_0057:  ldc.i4.s   10
6840  IL_0059:  newarr     ""int""
6841  IL_005e:  stloc.0
6842  IL_005f:  dup
6843  IL_0060:  ldloc.0
6844  IL_0061:  ldc.i4.0
6845  IL_0062:  callvirt   ""void System.Collections.ICollection.CopyTo(System.Array, int)""
6846  IL_0067:  dup
6847  IL_0068:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.GetFlagState()""
6848  IL_006d:  ldc.i4.s   28
6849  IL_006f:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6850  IL_0074:  pop
6851  IL_0075:  dup
6852  IL_0076:  callvirt   ""void Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.ClearFlag()""
6853  IL_007b:  dup
6854  IL_007c:  callvirt   ""int System.Collections.ICollection.Count.get""
6855  IL_0081:  pop
6856  IL_0082:  dup
6857  IL_0083:  callvirt   ""System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()""
6858  IL_0088:  pop
6859  IL_0089:  dup
6860  IL_008a:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.GetFlagState()""
6861  IL_008f:  ldc.i4.s   26
6862  IL_0091:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6863  IL_0096:  pop
6864  IL_0097:  dup
6865  IL_0098:  callvirt   ""void Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.ClearFlag()""
6866  IL_009d:  dup
6867  IL_009e:  ldc.i4.1
6868  IL_009f:  box        ""int""
6869  IL_00a4:  callvirt   ""int System.Collections.IList.IndexOf(object)""
6870  IL_00a9:  pop
6871  IL_00aa:  dup
6872  IL_00ab:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.GetFlagState()""
6873  IL_00b0:  ldc.i4.s   30
6874  IL_00b2:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6875  IL_00b7:  pop
6876  IL_00b8:  dup
6877  IL_00b9:  callvirt   ""void Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.ClearFlag()""
6878  IL_00be:  dup
6879  IL_00bf:  ldc.i4.1
6880  IL_00c0:  ldc.i4.2
6881  IL_00c1:  box        ""int""
6882  IL_00c6:  callvirt   ""void System.Collections.IList.Insert(int, object)""
6883  IL_00cb:  dup
6884  IL_00cc:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.GetFlagState()""
6885  IL_00d1:  ldc.i4.s   32
6886  IL_00d3:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6887  IL_00d8:  pop
6888  IL_00d9:  dup
6889  IL_00da:  callvirt   ""void Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.ClearFlag()""
6890  IL_00df:  dup
6891  IL_00e0:  callvirt   ""bool System.Collections.IList.IsReadOnly.get""
6892  IL_00e5:  pop
6893  IL_00e6:  dup
6894  IL_00e7:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.GetFlagState()""
6895  IL_00ec:  ldc.i4.0
6896  IL_00ed:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6897  IL_00f2:  pop
6898  IL_00f3:  dup
6899  IL_00f4:  callvirt   ""void Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.ClearFlag()""
6900  IL_00f9:  dup
6901  IL_00fa:  ldc.i4.0
6902  IL_00fb:  callvirt   ""object System.Collections.IList.this[int].get""
6903  IL_0100:  pop
6904  IL_0101:  dup
6905  IL_0102:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.GetFlagState()""
6906  IL_0107:  ldc.i4.s   27
6907  IL_0109:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6908  IL_010e:  pop
6909  IL_010f:  dup
6910  IL_0110:  callvirt   ""void Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.ClearFlag()""
6911  IL_0115:  dup
6912  IL_0116:  ldc.i4.1
6913  IL_0117:  callvirt   ""object System.Collections.IList.this[int].get""
6914  IL_011c:  pop
6915  IL_011d:  dup
6916  IL_011e:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.GetFlagState()""
6917  IL_0123:  ldc.i4.s   27
6918  IL_0125:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6919  IL_012a:  pop
6920  IL_012b:  dup
6921  IL_012c:  callvirt   ""void Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.ClearFlag()""
6922  IL_0131:  dup
6923  IL_0132:  ldc.i4.1
6924  IL_0133:  box        ""int""
6925  IL_0138:  callvirt   ""void System.Collections.IList.Remove(object)""
6926  IL_013d:  dup
6927  IL_013e:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.GetFlagState()""
6928  IL_0143:  ldc.i4.s   30
6929  IL_0145:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6930  IL_014a:  pop
6931  IL_014b:  dup
6932  IL_014c:  callvirt   ""void Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.ClearFlag()""
6933  IL_0151:  dup
6934  IL_0152:  ldc.i4.0
6935  IL_0153:  callvirt   ""void System.Collections.IList.RemoveAt(int)""
6936  IL_0158:  dup
6937  IL_0159:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.GetFlagState()""
6938  IL_015e:  ldc.i4.s   33
6939  IL_0160:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6940  IL_0165:  pop
6941  IL_0166:  dup
6942  IL_0167:  ldc.i4.1
6943  IL_0168:  box        ""int""
6944  IL_016d:  callvirt   ""int System.Collections.IList.Add(object)""
6945  IL_0172:  pop
6946  IL_0173:  dup
6947  IL_0174:  ldc.i4.2
6948  IL_0175:  box        ""int""
6949  IL_017a:  callvirt   ""int System.Collections.IList.Add(object)""
6950  IL_017f:  pop
6951  IL_0180:  dup
6952  IL_0181:  callvirt   ""void Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.ClearFlag()""
6953  IL_0186:  dup
6954  IL_0187:  callvirt   ""void System.Collections.IList.Clear()""
6955  IL_018c:  dup
6956  IL_018d:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.GetFlagState()""
6957  IL_0192:  ldc.i4.s   36
6958  IL_0194:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6959  IL_0199:  pop
6960  IL_019a:  dup
6961  IL_019b:  callvirt   ""void Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.ClearFlag()""
6962  IL_01a0:  ldnull
6963  IL_01a1:  ldftn      ""void AllMembers.v_CollectionChanged(object, System.Collections.Specialized.NotifyCollectionChangedEventArgs)""
6964  IL_01a7:  newobj     ""System.Collections.Specialized.NotifyCollectionChangedEventHandler..ctor(object, System.IntPtr)""
6965  IL_01ac:  stloc.1
6966  IL_01ad:  dup
6967  IL_01ae:  ldloc.1
6968  IL_01af:  callvirt   ""void System.Collections.Specialized.INotifyCollectionChanged.CollectionChanged.add""
6969  IL_01b4:  dup
6970  IL_01b5:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.GetFlagState()""
6971  IL_01ba:  ldc.i4.s   37
6972  IL_01bc:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6973  IL_01c1:  pop
6974  IL_01c2:  dup
6975  IL_01c3:  callvirt   ""void Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.ClearFlag()""
6976  IL_01c8:  dup
6977  IL_01c9:  ldloc.1
6978  IL_01ca:  callvirt   ""void System.Collections.Specialized.INotifyCollectionChanged.CollectionChanged.remove""
6979  IL_01cf:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.INotifyCollectionAndBindableVectorClass.GetFlagState()""
6980  IL_01d4:  ldc.i4.s   38
6981  IL_01d6:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
6982  IL_01db:  pop
6983  IL_01dc:  ret
6984}");
6985        }
6986
6987        [Fact]
6988        public void LegacyCollectionTest18()
6989        {
6990            var source =
6991@"using Windows.Languages.WinRTTest;
6992using System.Collections.Generic;
6993using System.Reflection;
6994using System.Linq.Expressions;
6995using System;
6996using System.Linq;
6997using System.Collections;
6998
6999class AllMembers
7000{
7001    private static int FailedCount = 0;
7002    private static bool ValidateMethod(TestMethodCalled actual, TestMethodCalled expected)
7003    {
7004        var temp = Console.ForegroundColor;
7005        if (actual != expected)
7006        {
7007            FailedCount++;
7008            Console.ForegroundColor = ConsoleColor.Red;
7009            Console.Write(""FAIL:  "");
7010        }
7011        else
7012        {
7013            Console.ForegroundColor = ConsoleColor.Green;
7014            Console.Write(""PASS:  "");
7015        }
7016
7017        Console.ForegroundColor = temp;
7018        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
7019        return actual == expected;
7020    }
7021
7022    static void INotifyCollectionChangedMembers()
7023    {
7024        Console.WriteLine(""===  INotifyCollectionChangedClass  ==="");
7025        var v = new INotifyCollectionChangedClass();
7026
7027        //Events
7028        //Add event
7029        v.ClearFlag();
7030        var dele = new System.Collections.Specialized.NotifyCollectionChangedEventHandler(v_CollectionChanged);
7031        v.CollectionChanged += dele;
7032        ValidateMethod(v.GetFlagState(), TestMethodCalled.INotifyCollectionChanged_Add_CollectionChanged);
7033
7034        //Remove event
7035        v.ClearFlag();
7036        v.CollectionChanged -= dele;
7037        ValidateMethod(v.GetFlagState(), TestMethodCalled.INotifyCollectionChanged_Remove_CollectionChanged);
7038    }
7039
7040    static void v_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
7041    {
7042        throw new NotImplementedException();
7043    }
7044
7045    static void v_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
7046    {
7047        throw new NotImplementedException();
7048    }
7049
7050    static int Main()
7051    {
7052        INotifyCollectionChangedMembers();
7053
7054        Console.WriteLine(FailedCount);
7055        return FailedCount;
7056    }
7057}";
7058            var verifier = CompileAndVerify(
7059                source,
7060                emitOptions: EmitOptions.RefEmitBug,
7061                additionalRefs: LegacyRefs,
7062                verify: false);
7063            verifier.VerifyDiagnostics(
7064                // (2,1): info CS8019: Unnecessary using directive.
7065                // using System.Collections.Generic;
7066                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Collections.Generic;"),
7067                // (3,1): info CS8019: Unnecessary using directive.
7068                // using System.Reflection;
7069                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Reflection;"),
7070                // (4,1): info CS8019: Unnecessary using directive.
7071                // using System.Linq.Expressions;
7072                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq.Expressions;"),
7073                // (6,1): info CS8019: Unnecessary using directive.
7074                // using System.Linq;
7075                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq;"),
7076                // (7,1): info CS8019: Unnecessary using directive.
7077                // using System.Collections;
7078                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Collections;"));
7079            verifier.VerifyIL("AllMembers.INotifyCollectionChangedMembers",
7080@"
7081{
7082  // Code size       82 (0x52)
7083  .maxstack  3
7084  .locals init (System.Collections.Specialized.NotifyCollectionChangedEventHandler V_0) //dele
7085  IL_0000:  ldstr      ""===  INotifyCollectionChangedClass  ===""
7086  IL_0005:  call       ""void System.Console.WriteLine(string)""
7087  IL_000a:  newobj     ""Windows.Languages.WinRTTest.INotifyCollectionChangedClass..ctor()""
7088  IL_000f:  dup
7089  IL_0010:  callvirt   ""void Windows.Languages.WinRTTest.INotifyCollectionChangedClass.ClearFlag()""
7090  IL_0015:  ldnull
7091  IL_0016:  ldftn      ""void AllMembers.v_CollectionChanged(object, System.Collections.Specialized.NotifyCollectionChangedEventArgs)""
7092  IL_001c:  newobj     ""System.Collections.Specialized.NotifyCollectionChangedEventHandler..ctor(object, System.IntPtr)""
7093  IL_0021:  stloc.0
7094  IL_0022:  dup
7095  IL_0023:  ldloc.0
7096  IL_0024:  callvirt   ""void System.Collections.Specialized.INotifyCollectionChanged.CollectionChanged.add""
7097  IL_0029:  dup
7098  IL_002a:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.INotifyCollectionChangedClass.GetFlagState()""
7099  IL_002f:  ldc.i4.s   37
7100  IL_0031:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
7101  IL_0036:  pop
7102  IL_0037:  dup
7103  IL_0038:  callvirt   ""void Windows.Languages.WinRTTest.INotifyCollectionChangedClass.ClearFlag()""
7104  IL_003d:  dup
7105  IL_003e:  ldloc.0
7106  IL_003f:  callvirt   ""void System.Collections.Specialized.INotifyCollectionChanged.CollectionChanged.remove""
7107  IL_0044:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.INotifyCollectionChangedClass.GetFlagState()""
7108  IL_0049:  ldc.i4.s   38
7109  IL_004b:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
7110  IL_0050:  pop
7111  IL_0051:  ret
7112}");
7113        }
7114
7115        [Fact]
7116        public void LegacyCollectionTest19()
7117        {
7118            var source =
7119@"using Windows.Languages.WinRTTest;
7120using System.Collections.Generic;
7121using System.Reflection;
7122using System.Linq.Expressions;
7123using System;
7124using System.Linq;
7125using System.Collections;
7126
7127class AllMembers
7128{
7129    private static int FailedCount = 0;
7130    private static bool ValidateMethod(TestMethodCalled actual, TestMethodCalled expected)
7131    {
7132        var temp = Console.ForegroundColor;
7133        if (actual != expected)
7134        {
7135            FailedCount++;
7136            Console.ForegroundColor = ConsoleColor.Red;
7137            Console.Write(""FAIL:  "");
7138        }
7139        else
7140        {
7141            Console.ForegroundColor = ConsoleColor.Green;
7142            Console.Write(""PASS:  "");
7143        }
7144
7145        Console.ForegroundColor = temp;
7146        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
7147        return actual == expected;
7148    }
7149
7150    static void INotifyCollectionChangedMembers()
7151    {
7152        Console.WriteLine(""===  INotifyCollectionChangedClass  ==="");
7153        var v = new INotifyCollectionChangedClass();
7154
7155        //Events
7156        //Add event
7157        v.ClearFlag();
7158        var dele = new System.Collections.Specialized.NotifyCollectionChangedEventHandler(v_CollectionChanged);
7159        v.CollectionChanged += dele;
7160        ValidateMethod(v.GetFlagState(), TestMethodCalled.INotifyCollectionChanged_Add_CollectionChanged);
7161
7162        //Remove event
7163        v.ClearFlag();
7164        v.CollectionChanged -= dele;
7165        ValidateMethod(v.GetFlagState(), TestMethodCalled.INotifyCollectionChanged_Remove_CollectionChanged);
7166    }
7167
7168    static void v_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
7169    {
7170        throw new NotImplementedException();
7171    }
7172
7173    static void v_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
7174    {
7175        throw new NotImplementedException();
7176    }
7177
7178    static int Main()
7179    {
7180        INotifyCollectionChangedMembers();
7181
7182        Console.WriteLine(FailedCount);
7183        return FailedCount;
7184    }
7185}";
7186            var verifier = CompileAndVerify(
7187                source,
7188                emitOptions: EmitOptions.RefEmitBug,
7189                additionalRefs: LegacyRefs,
7190                verify: false);
7191            verifier.VerifyDiagnostics(
7192                // (2,1): info CS8019: Unnecessary using directive.
7193                // using System.Collections.Generic;
7194                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Collections.Generic;"),
7195                // (3,1): info CS8019: Unnecessary using directive.
7196                // using System.Reflection;
7197                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Reflection;"),
7198                // (4,1): info CS8019: Unnecessary using directive.
7199                // using System.Linq.Expressions;
7200                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq.Expressions;"),
7201                // (6,1): info CS8019: Unnecessary using directive.
7202                // using System.Linq;
7203                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq;"),
7204                // (7,1): info CS8019: Unnecessary using directive.
7205                // using System.Collections;
7206                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Collections;"));
7207            verifier.VerifyIL("AllMembers.INotifyCollectionChangedMembers",
7208@"
7209{
7210  // Code size       82 (0x52)
7211  .maxstack  3
7212  .locals init (System.Collections.Specialized.NotifyCollectionChangedEventHandler V_0) //dele
7213  IL_0000:  ldstr      ""===  INotifyCollectionChangedClass  ===""
7214  IL_0005:  call       ""void System.Console.WriteLine(string)""
7215  IL_000a:  newobj     ""Windows.Languages.WinRTTest.INotifyCollectionChangedClass..ctor()""
7216  IL_000f:  dup
7217  IL_0010:  callvirt   ""void Windows.Languages.WinRTTest.INotifyCollectionChangedClass.ClearFlag()""
7218  IL_0015:  ldnull
7219  IL_0016:  ldftn      ""void AllMembers.v_CollectionChanged(object, System.Collections.Specialized.NotifyCollectionChangedEventArgs)""
7220  IL_001c:  newobj     ""System.Collections.Specialized.NotifyCollectionChangedEventHandler..ctor(object, System.IntPtr)""
7221  IL_0021:  stloc.0
7222  IL_0022:  dup
7223  IL_0023:  ldloc.0
7224  IL_0024:  callvirt   ""void System.Collections.Specialized.INotifyCollectionChanged.CollectionChanged.add""
7225  IL_0029:  dup
7226  IL_002a:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.INotifyCollectionChangedClass.GetFlagState()""
7227  IL_002f:  ldc.i4.s   37
7228  IL_0031:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
7229  IL_0036:  pop
7230  IL_0037:  dup
7231  IL_0038:  callvirt   ""void Windows.Languages.WinRTTest.INotifyCollectionChangedClass.ClearFlag()""
7232  IL_003d:  dup
7233  IL_003e:  ldloc.0
7234  IL_003f:  callvirt   ""void System.Collections.Specialized.INotifyCollectionChanged.CollectionChanged.remove""
7235  IL_0044:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.INotifyCollectionChangedClass.GetFlagState()""
7236  IL_0049:  ldc.i4.s   38
7237  IL_004b:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
7238  IL_0050:  pop
7239  IL_0051:  ret
7240}");
7241        }
7242
7243        [Fact]
7244        public void LegacyCollectionTest20()
7245        {
7246            var source =
7247@"using Windows.Languages.WinRTTest;
7248using System.Collections.Generic;
7249using System.Reflection;
7250using System.Linq.Expressions;
7251using System;
7252using System.Linq;
7253using System.Collections;
7254
7255class AllMembers
7256{
7257    private static int FailedCount = 0;
7258    private static bool ValidateMethod(TestMethodCalled actual, TestMethodCalled expected)
7259    {
7260        var temp = Console.ForegroundColor;
7261        if (actual != expected)
7262        {
7263            FailedCount++;
7264            Console.ForegroundColor = ConsoleColor.Red;
7265            Console.Write(""FAIL:  "");
7266        }
7267        else
7268        {
7269            Console.ForegroundColor = ConsoleColor.Green;
7270            Console.Write(""PASS:  "");
7271        }
7272
7273        Console.ForegroundColor = temp;
7274        Console.WriteLine(""Expected: {0}, Actual: {1}"", expected, actual);
7275        return actual == expected;
7276    }
7277
7278    static void IPropertyChangedMembers()
7279    {
7280        Console.WriteLine(""===  INotifyCollectionChangedClass  ==="");
7281        var v = new INotifyPropertyChangedClass();
7282
7283        // PropertyChanged
7284        //Add
7285        v.ClearFlag();
7286        var pdeleg = new System.ComponentModel.PropertyChangedEventHandler(v_PropertyChanged);
7287        v.PropertyChanged += pdeleg;
7288        ValidateMethod(v.GetFlagState(), TestMethodCalled.INotifyPropertyChanged_Add_PropertyChanged);
7289        //Remove
7290        v.ClearFlag();
7291        v.PropertyChanged -= pdeleg;
7292        ValidateMethod(v.GetFlagState(), TestMethodCalled.INotifyPropertyChanged_Remove_PropertyChanged);
7293    }
7294
7295    static void v_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
7296    {
7297        throw new NotImplementedException();
7298    }
7299
7300    static int Main()
7301    {
7302        IPropertyChangedMembers();
7303
7304        Console.WriteLine(FailedCount);
7305        return FailedCount;
7306    }
7307}";
7308            var verifier = CompileAndVerify(
7309                source,
7310                emitOptions: EmitOptions.RefEmitBug,
7311                additionalRefs: LegacyRefs,
7312                verify: false);
7313            verifier.VerifyDiagnostics(
7314                // (2,1): info CS8019: Unnecessary using directive.
7315                // using System.Collections.Generic;
7316                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Collections.Generic;"),
7317                // (3,1): info CS8019: Unnecessary using directive.
7318                // using System.Reflection;
7319                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Reflection;"),
7320                // (4,1): info CS8019: Unnecessary using directive.
7321                // using System.Linq.Expressions;
7322                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq.Expressions;"),
7323                // (6,1): info CS8019: Unnecessary using directive.
7324                // using System.Linq;
7325                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Linq;"),
7326                // (7,1): info CS8019: Unnecessary using directive.
7327                // using System.Collections;
7328                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System.Collections;"));
7329            verifier.VerifyIL("AllMembers.IPropertyChangedMembers",
7330@"
7331{
7332  // Code size       82 (0x52)
7333  .maxstack  3
7334  .locals init (System.ComponentModel.PropertyChangedEventHandler V_0) //pdeleg
7335  IL_0000:  ldstr      ""===  INotifyCollectionChangedClass  ===""
7336  IL_0005:  call       ""void System.Console.WriteLine(string)""
7337  IL_000a:  newobj     ""Windows.Languages.WinRTTest.INotifyPropertyChangedClass..ctor()""
7338  IL_000f:  dup
7339  IL_0010:  callvirt   ""void Windows.Languages.WinRTTest.INotifyPropertyChangedClass.ClearFlag()""
7340  IL_0015:  ldnull
7341  IL_0016:  ldftn      ""void AllMembers.v_PropertyChanged(object, System.ComponentModel.PropertyChangedEventArgs)""
7342  IL_001c:  newobj     ""System.ComponentModel.PropertyChangedEventHandler..ctor(object, System.IntPtr)""
7343  IL_0021:  stloc.0
7344  IL_0022:  dup
7345  IL_0023:  ldloc.0
7346  IL_0024:  callvirt   ""void System.ComponentModel.INotifyPropertyChanged.PropertyChanged.add""
7347  IL_0029:  dup
7348  IL_002a:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.INotifyPropertyChangedClass.GetFlagState()""
7349  IL_002f:  ldc.i4.s   39
7350  IL_0031:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
7351  IL_0036:  pop
7352  IL_0037:  dup
7353  IL_0038:  callvirt   ""void Windows.Languages.WinRTTest.INotifyPropertyChangedClass.ClearFlag()""
7354  IL_003d:  dup
7355  IL_003e:  ldloc.0
7356  IL_003f:  callvirt   ""void System.ComponentModel.INotifyPropertyChanged.PropertyChanged.remove""
7357  IL_0044:  callvirt   ""Windows.Languages.WinRTTest.TestMethodCalled Windows.Languages.WinRTTest.INotifyPropertyChangedClass.GetFlagState()""
7358  IL_0049:  ldc.i4.s   40
7359  IL_004b:  call       ""bool AllMembers.ValidateMethod(Windows.Languages.WinRTTest.TestMethodCalled, Windows.Languages.WinRTTest.TestMethodCalled)""
7360  IL_0050:  pop
7361  IL_0051:  ret
7362}
7363");
7364        }
7365
7366        [Fact]
7367        public void WinRTCompilationReference()
7368        {
7369            var source =
7370@"using System.Collections;
7371using System.Collections.Generic;
7372
7373namespace Test
7374{
7375    public class C : IEnumerable<int>
7376    {
7377        IEnumerator IEnumerable.GetEnumerator()
7378        {
7379            return null;
7380        }
7381
7382        public IEnumerator<int> GetEnumerator()
7383        {
7384            return null;
7385        }   
7386    }
7387}";
7388            var verifier = CompileAndVerify(source,
7389                options: TestOptions.WinMDObj,
7390                emitOptions: EmitOptions.RefEmitBug,
7391                additionalRefs: WinRtRefs);
7392
7393            verifier.VerifyDiagnostics();
7394            verifier.VerifyIL("Test.C.GetEnumerator()",
7395@"{
7396  // Code size        6 (0x6)
7397  .maxstack  1
7398  .locals init (System.Collections.Generic.IEnumerator<int> V_0)
7399  IL_0000:  ldnull
7400  IL_0001:  stloc.0
7401  IL_0002:  br.s       IL_0004
7402  IL_0004:  ldloc.0
7403  IL_0005:  ret
7404}");
7405
7406            var compRef = verifier.Compilation.ToMetadataReference();
7407            var allRefs = new List<MetadataReference>(WinRtRefs);
7408            allRefs.Add(compRef);
7409            source =
7410@"using System;
7411using Test;
7412
7413namespace Test2
7414{
7415    public class D
7416    {
7417        public static void Main(string[] args)
7418        {
7419            var c = new C();
7420            var e = c.GetEnumerator();
7421        }
7422    }
7423}";
7424            verifier = CompileAndVerify(source,
7425                emitOptions: EmitOptions.RefEmitBug,
7426                additionalRefs: allRefs.ToArray());
7427            verifier.VerifyDiagnostics(
7428                // (1,1): info CS8019: Unnecessary using directive.
7429                // using System;
7430                Diagnostic(ErrorCode.INF_UnusedUsingDirective, "using System;"));
7431            verifier.VerifyIL("Test2.D.Main",
7432@"{
7433  // Code size       12 (0xc)
7434  .maxstack  1
7435  IL_0000:  newobj     ""Test.C..ctor()""
7436  IL_0005:  callvirt   ""System.Collections.Generic.IEnumerator<int> Test.C.GetEnumerator()""
7437  IL_000a:  pop
7438  IL_000b:  ret
7439}");
7440        }
7441
7442    }
7443}