/Src/Compilers/CSharp/Test/Syntax/Parsing/ParserErrorMessageTests.cs
C# | 4833 lines | 3733 code | 345 blank | 755 comment | 0 complexity | b9bf06fc231d64395ae251b9abc9c464 MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- // 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.
- using System.Linq;
- using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
- using Microsoft.CodeAnalysis.Test.Utilities;
- using Roslyn.Test.Utilities;
- using Xunit;
- namespace Microsoft.CodeAnalysis.CSharp.UnitTests
- {
- public class ParserErrorMessageTests : CSharpTestBase
- {
- #region "Targeted Error Tests - please arrange tests in the order of error code"
- [WorkItem(536666, "DevDiv")]
- [Fact]
- public void CS0071ERR_ExplicitEventFieldImpl()
- {
- // Diff errors
- var test = @"
- public delegate void D();
- interface Itest
- {
- event D E;
- }
- class Test : Itest
- {
- event D ITest.E() // CS0071
- {
- }
- public static int Main()
- {
- return 1;
- }
- }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_ExplicitEventFieldImpl, "."), Diagnostic(ErrorCode.ERR_MemberNeedsType, "E"));
- }
- // Infinite loop
- [Fact]
- public void CS0073ERR_AddRemoveMustHaveBody()
- {
- var test = @"
- using System;
- class C
- {
- event Action E { add; remove; }
- }
- abstract class A
- {
- public abstract event Action E { add; remove; }
- }
- ";
- CreateCompilationWithMscorlib(test).VerifyDiagnostics(
- // (5,25): error CS0073: An add or remove accessor must have a body
- // event Action E { add; remove; }
- Diagnostic(ErrorCode.ERR_AddRemoveMustHaveBody, ";"),
- // (5,33): error CS0073: An add or remove accessor must have a body
- // event Action E { add; remove; }
- Diagnostic(ErrorCode.ERR_AddRemoveMustHaveBody, ";"),
- // (9,41): error CS0073: An add or remove accessor must have a body
- // public abstract event Action E { add; remove; }
- Diagnostic(ErrorCode.ERR_AddRemoveMustHaveBody, ";"),
- // (9,49): error CS0073: An add or remove accessor must have a body
- // public abstract event Action E { add; remove; }
- Diagnostic(ErrorCode.ERR_AddRemoveMustHaveBody, ";"));
- }
- [Fact]
- public void CS0080ERR_ConstraintOnlyAllowedOnGenericDecl()
- {
- var test = @"
- interface I {}
- class C where C : I // CS0080 - C is not generic class
- {
- }
- public class Test
- {
- public static int Main ()
- {
- return 1;
- }
- }
- ";
- CreateCompilationWithMscorlib(test).VerifyDiagnostics(
- // (3,9): error CS0080: Constraints are not allowed on non-generic declarations
- Diagnostic(ErrorCode.ERR_ConstraintOnlyAllowedOnGenericDecl, "where").WithLocation(3, 9));
- }
- [WorkItem(527827, "DevDiv")]
- [Fact]
- public void CS0080ERR_ConstraintOnlyAllowedOnGenericDecl_2()
- {
- var test = @"
- class C
- where C : I
- {
- }
- ";
- CreateCompilationWithMscorlib(test).VerifyDiagnostics(
- // (3,5): error CS0080: Constraints are not allowed on non-generic declarations
- // where C : I
- Diagnostic(ErrorCode.ERR_ConstraintOnlyAllowedOnGenericDecl, "where"));
- }
- [Fact]
- public void CS0107ERR_BadMemberProtection()
- {
- var test = @"
- public class C
- {
- private internal void f() {}
- public static int Main()
- {
- return 1;
- }
- }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_BadMemberProtection, "internal"));
- }
- [Fact, WorkItem(543622, "DevDiv")]
- public void CS0116ERR__NamespaceUnexpected()
- {
- var test = @"{
- get
- {
- ParseDefaultDir();
- }
- }";
- // Extra errors
- ParseAndValidate(test,
- // (1,1): error CS1022: Type or namespace definition, or end-of-file expected
- // {
- Diagnostic(ErrorCode.ERR_EOFExpected, "{"),
- // (3,5): error CS1022: Type or namespace definition, or end-of-file expected
- // {
- Diagnostic(ErrorCode.ERR_EOFExpected, "{"),
- // (3,6): error CS1520: Method must have a return type
- // {
- Diagnostic(ErrorCode.ERR_MemberNeedsType, ""),
- // (2,5): error CS0116: A namespace does not directly contain members such as fields or methods
- // get
- Diagnostic(ErrorCode.ERR_NamespaceUnexpected, "get"),
- // (5,5): error CS1022: Type or namespace definition, or end-of-file expected
- // }
- Diagnostic(ErrorCode.ERR_EOFExpected, "}"),
- // (6,1): error CS1022: Type or namespace definition, or end-of-file expected
- // }
- Diagnostic(ErrorCode.ERR_EOFExpected, "}"));
- }
- [Fact]
- public void CS0145ERR_ConstValueRequired()
- {
- var test = @"
- namespace x
- {
- public class a
- {
- public static int Main()
- {
- return 1;
- }
- }
- public class b : a
- {
- public const int i;
- }
- }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_ConstValueRequired, "i"));
- }
- [WorkItem(536667, "DevDiv")]
- [Fact]
- public void CS0150ERR_ConstantExpected()
- {
- var test = @"
- using namespace System;
- public class mine {
- public enum e1 {one=1, two=2, three= };
- public static int Main()
- {
- return 1;
- }
- };
- }
- ";
- ParseAndValidate(test,
- // (2,7): error CS1041: Identifier expected; 'namespace' is a keyword
- // using namespace System;
- Diagnostic(ErrorCode.ERR_IdentifierExpectedKW, "namespace").WithArguments("", "namespace"),
- // (2,23): error CS1514: { expected
- // using namespace System;
- Diagnostic(ErrorCode.ERR_LbraceExpected, ";"),
- // (4,42): error CS0150: A constant value is expected
- // public enum e1 {one=1, two=2, three= };
- Diagnostic(ErrorCode.ERR_ConstantExpected, ""));
- }
- [WorkItem(862028, "DevDiv/Personal")]
- [Fact]
- public void CS0178ERR_InvalidArray()
- {
- // Diff errors
- var test = @"
- class A
- {
- public static int Main()
- {
- int[] arr = new int[5][5;
- return 1;
- }
- }
- ";
- ParseAndValidate(test,
- // (6,32): error CS0178: Invalid rank specifier: expected ',' or ']'
- // int[] arr = new int[5][5;
- Diagnostic(ErrorCode.ERR_InvalidArray, "5"),
- // (6,33): error CS1003: Syntax error, ',' expected
- // int[] arr = new int[5][5;
- Diagnostic(ErrorCode.ERR_SyntaxError, ";").WithArguments(",", ";"),
- // (6,33): error CS0443: Syntax error; value expected
- // int[] arr = new int[5][5;
- Diagnostic(ErrorCode.ERR_ValueExpected, ""),
- // (6,33): error CS1003: Syntax error, ']' expected
- // int[] arr = new int[5][5;
- Diagnostic(ErrorCode.ERR_SyntaxError, ";").WithArguments("]", ";"));
- }
- [WorkItem(862031, "DevDiv/Personal")]
- [Fact]
- public void CS0201ERR_IllegalStatement()
- {
- var test = @"
- class A
- {
- public static int Main()
- {
- (a) => a;
- (a, b) =>
- {
- };
- int x = 0; int y = 0;
- x + y; x == 1;
- }
- }
- ";
- ParseAndValidate(test);
- }
- [Fact]
- public void CS0230ERR_BadForeachDecl()
- {
- var test = @"
- class MyClass
- {
- public static int Main()
- {
- int[] myarray = new int[3] {10,2,3};
- foreach (int in myarray) // CS0230
- {
- }
- return 1;
- }
- }
- ";
- ParseAndValidate(test,
- // (7,22): error CS1001: Identifier expected
- // foreach (int in myarray) // CS0230
- Diagnostic(ErrorCode.ERR_IdentifierExpected, "in"),
- // (7,22): error CS0230: Type and identifier are both required in a foreach statement
- // foreach (int in myarray) // CS0230
- Diagnostic(ErrorCode.ERR_BadForeachDecl, "in") );
- }
- [Fact]
- public void CS0230ERR_BadForeachDecl02()
- {
- // TODO: Extra error
- var test = @"
- public class Test
- {
- static void Main(string[] args)
- {
- int[] myarray = new int[3] { 1, 2, 3 };
- foreach (x in myarray) { }// Invalid
- }
- }
- ";
- ParseAndValidate(test,
- // (7,20): error CS1001: Identifier expected
- // foreach (x in myarray) { }// Invalid
- Diagnostic(ErrorCode.ERR_IdentifierExpected, "in"),
- // (7,20): error CS0230: Type and identifier are both required in a foreach statement
- // foreach (x in myarray) { }// Invalid
- Diagnostic(ErrorCode.ERR_BadForeachDecl, "in"));
- }
- [Fact]
- public void CS0230ERR_BadForeachDecl03()
- {
- // TODO: Extra error
- var test = @"
- public class Test
- {
- static void Main(string[] args)
- {
- st[][] myarray = new st[1000][];
- foreach (st[] in myarray) { }
- }
- }
- public struct st { }
- ";
- ParseAndValidate(test,
- // (7,23): error CS1001: Identifier expected
- // foreach (st[] in myarray) { }
- Diagnostic(ErrorCode.ERR_IdentifierExpected, "in"),
- // (7,23): error CS0230: Type and identifier are both required in a foreach statement
- // foreach (st[] in myarray) { }
- Diagnostic(ErrorCode.ERR_BadForeachDecl, "in"));
- }
- [Fact]
- public void CS0231ERR_ParamsLast()
- {
- var test = @"
- using System;
- public class MyClass {
- public void MyMeth(params int[] values, int i) {}
- public static int Main() {
- return 1;
- }
- }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_ParamsLast, "params int[] values"));
- }
- [Fact]
- public void CS0257ERR_VarargsLast()
- {
- var test = @"
- class Foo
- {
- public void Bar(__arglist, int b)
- {
- }
- }
- ";
- ParseAndValidate(test,
- // (4,19): error CS0257: An __arglist parameter must be the last parameter in a formal parameter list
- // public void Bar(__arglist, int b)
- Diagnostic(ErrorCode.ERR_VarargsLast, "__arglist"));
- }
- [WorkItem(536668, "DevDiv")]
- [Fact]
- public void CS0267ERR_PartialMisplaced()
- {
- // Diff error
- var test = @"
- partial public class C // CS0267
- {
- }
- public class Test
- {
- public static int Main ()
- {
- return 1;
- }
- }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_PartialMisplaced, "partial") );
- }
- [Fact]
- public void CS0267ERR_PartialMisplaced_Enum()
- {
- var test = @"
- partial enum E { }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_PartialMisplaced, "partial"));
- }
- [Fact]
- public void CS0267ERR_PartialMisplaced_Delegate()
- {
- var test = @"
- partial delegate E { }
- ";
- // Extra errors
- ParseAndValidate(test,
- // (2,1): error CS0267: The 'partial' modifier can only appear immediately before 'class', 'struct', 'interface', or 'void'
- // partial delegate E { }
- Diagnostic(ErrorCode.ERR_PartialMisplaced, "partial"),
- // (2,20): error CS1001: Identifier expected
- // partial delegate E { }
- Diagnostic(ErrorCode.ERR_IdentifierExpected, "{"),
- // (2,20): error CS1003: Syntax error, '(' expected
- // partial delegate E { }
- Diagnostic(ErrorCode.ERR_SyntaxError, "{").WithArguments("(", "{"),
- // (2,20): error CS1026: ) expected
- // partial delegate E { }
- Diagnostic(ErrorCode.ERR_CloseParenExpected, "{"),
- // (2,20): error CS1002: ; expected
- // partial delegate E { }
- Diagnostic(ErrorCode.ERR_SemicolonExpected, "{"),
- // (2,20): error CS1022: Type or namespace definition, or end-of-file expected
- // partial delegate E { }
- Diagnostic(ErrorCode.ERR_EOFExpected, "{"),
- // (2,22): error CS1022: Type or namespace definition, or end-of-file expected
- // partial delegate E { }
- Diagnostic(ErrorCode.ERR_EOFExpected, "}"));
- }
- // TODO: Extra errors
- [Fact]
- public void CS0270ERR_ArraySizeInDeclaration()
- {
- var test = @"
- public class MyClass
- {
- enum E { }
- public static void Main()
- {
- int myarray[2];
- MyClass m[0];
- byte b[13,5];
- double d[14,5,6];
- E e[,50];
- }
- }
- ";
- ParseAndValidate(test,
- // (7,20): error CS0650: Bad array declarator: To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed size buffer field, use the fixed keyword before the field type.
- // int myarray[2];
- Diagnostic(ErrorCode.ERR_CStyleArray, "[2]"),
- // (7,21): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
- // int myarray[2];
- Diagnostic(ErrorCode.ERR_ArraySizeInDeclaration, "2"),
- // (8,18): error CS0650: Bad array declarator: To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed size buffer field, use the fixed keyword before the field type.
- // MyClass m[0];
- Diagnostic(ErrorCode.ERR_CStyleArray, "[0]"),
- // (8,19): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
- // MyClass m[0];
- Diagnostic(ErrorCode.ERR_ArraySizeInDeclaration, "0"),
- // (9,15): error CS0650: Bad array declarator: To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed size buffer field, use the fixed keyword before the field type.
- // byte b[13,5];
- Diagnostic(ErrorCode.ERR_CStyleArray, "[13,5]"),
- // (9,16): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
- // byte b[13,5];
- Diagnostic(ErrorCode.ERR_ArraySizeInDeclaration, "13"),
- // (9,19): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
- // byte b[13,5];
- Diagnostic(ErrorCode.ERR_ArraySizeInDeclaration, "5"),
- // (10,17): error CS0650: Bad array declarator: To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed size buffer field, use the fixed keyword before the field type.
- // double d[14,5,6];
- Diagnostic(ErrorCode.ERR_CStyleArray, "[14,5,6]"),
- // (10,18): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
- // double d[14,5,6];
- Diagnostic(ErrorCode.ERR_ArraySizeInDeclaration, "14"),
- // (10,21): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
- // double d[14,5,6];
- Diagnostic(ErrorCode.ERR_ArraySizeInDeclaration, "5"),
- // (10,23): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
- // double d[14,5,6];
- Diagnostic(ErrorCode.ERR_ArraySizeInDeclaration, "6"),
- // (11,12): error CS0650: Bad array declarator: To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed size buffer field, use the fixed keyword before the field type.
- // E e[,50];
- Diagnostic(ErrorCode.ERR_CStyleArray, "[,50]"),
- // (11,13): error CS0443: Syntax error; value expected
- // E e[,50];
- Diagnostic(ErrorCode.ERR_ValueExpected, ""),
- // (11,14): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
- // E e[,50];
- Diagnostic(ErrorCode.ERR_ArraySizeInDeclaration, "50"));
- }
- [Fact]
- public void CS0401ERR_NewBoundMustBeLast()
- {
- var test = @"
- interface IA
- {
- }
- class C<T> where T : new(), IA // CS0401 - should be T : IA, new()
- {
- }
- public class Test
- {
- public static int Main ()
- {
- return 1;
- }
- }
- ";
- CreateCompilationWithMscorlib(test).VerifyDiagnostics(
- // (5,22): error CS0401: The new() constraint must be the last constraint specified
- Diagnostic(ErrorCode.ERR_NewBoundMustBeLast, "new").WithLocation(5, 22));
- }
- [Fact]
- public void CS0439ERR_ExternAfterElements()
- {
- var test = @"
- using System;
- extern alias MyType; // CS0439
- // To resolve the error, make the extern alias the first line in the file.
- public class Test
- {
- public static void Main()
- {
- }
- }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_ExternAfterElements, "extern"));
- }
- [WorkItem(862086, "DevDiv/Personal")]
- [Fact]
- public void CS0443ERR_ValueExpected()
- {
- var test = @"
- using System;
- class MyClass
- {
- public static void Main()
- {
- int[,] x = new int[1,5];
- if (x[] == 5) {} // CS0443
- // if (x[0, 0] == 5) {}
- }
- }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_ValueExpected, "]"));
- }
- [Fact]
- public void CS0443ERR_ValueExpected_MultiDimensional()
- {
- var test = @"
- using System;
- class MyClass
- {
- public static void Main()
- {
- int[,] x = new int[1,5];
- if (x[,] == 5) {} // CS0443
- // if (x[0, 0] == 5) {}
- }
- }
- ";
- ParseAndValidate(test,
- // (8,15): error CS0443: Syntax error; value expected
- // if (x[,] == 5) {} // CS0443
- Diagnostic(ErrorCode.ERR_ValueExpected, ","),
- // (8,16): error CS0443: Syntax error; value expected
- // if (x[,] == 5) {} // CS0443
- Diagnostic(ErrorCode.ERR_ValueExpected, "]"));
- }
- [Fact]
- public void CS0449ERR_RefValBoundMustBeFirst()
- {
- var test = @"
- interface I {}
- class C4
- {
- public void F1<T>() where T : class, struct, I {} // CS0449
- public void F2<T>() where T : I, struct {} // CS0449
- public void F3<T>() where T : I, class {} // CS0449
- // OK
- public void F4<T>() where T : class {}
- public void F5<T>() where T : struct {}
- public void F6<T>() where T : I {}
- }
- ";
- CreateCompilationWithMscorlib(test).VerifyDiagnostics(
- // (5,41): error CS0449: The 'class' or 'struct' constraint must come before any other constraints
- Diagnostic(ErrorCode.ERR_RefValBoundMustBeFirst, "struct").WithLocation(5, 41),
- // (6,37): error CS0449: The 'class' or 'struct' constraint must come before any other constraints
- Diagnostic(ErrorCode.ERR_RefValBoundMustBeFirst, "struct").WithLocation(6, 37),
- // (7,37): error CS0449: The 'class' or 'struct' constraint must come before any other constraints
- Diagnostic(ErrorCode.ERR_RefValBoundMustBeFirst, "class").WithLocation(7, 37));
- }
- [Fact]
- public void CS0451ERR_NewBoundWithVal()
- {
- var test = @"
- public class C4
- {
- public void F4<T>() where T : struct, new() {} // CS0451
- }
- // OK
- public class C5
- {
- public void F5<T>() where T : struct {}
- }
- public class C6
- {
- public void F6<T>() where T : new() {}
- }
- ";
- CreateCompilationWithMscorlib(test).VerifyDiagnostics(
- // (4,42): error CS0451: The 'new()' constraint cannot be used with the 'struct' constraint
- Diagnostic(ErrorCode.ERR_NewBoundWithVal, "new").WithLocation(4, 42));
- }
- [WorkItem(862089, "DevDiv/Personal")]
- [Fact]
- public void CS0460ERR_OverrideWithConstraints()
- {
- var source =
- @"interface I
- {
- void M1<T>() where T : I;
- void M2<T, U>();
- }
- abstract class A
- {
- internal virtual void M1<T>() where T : class { }
- internal abstract void M2<T>() where T : struct;
- internal abstract void M3<T>();
- }
- abstract class B : A, I
- {
- void I.M1<T>() where T : I { }
- void I.M2<T,U>() where U : T { }
- internal override void M1<T>() where T : class { }
- internal override void M2<T>() where T : new() { }
- internal override abstract void M3<U>() where U : A;
- internal override abstract void M4<T>() where T : struct;
- }";
- CreateCompilationWithMscorlib(source).VerifyDiagnostics(
- // (14,20): error CS0460: Constraints for override and explicit interface implementation methods are inherited from the base method, so they cannot be specified directly
- Diagnostic(ErrorCode.ERR_OverrideWithConstraints, "where").WithLocation(14, 20),
- // (15,22): error CS0460: Constraints for override and explicit interface implementation methods are inherited from the base method, so they cannot be specified directly
- Diagnostic(ErrorCode.ERR_OverrideWithConstraints, "where").WithLocation(15, 22),
- // (16,37): error CS0460: Constraints for override and explicit interface implementation methods are inherited from the base method, so they cannot be specified directly
- Diagnostic(ErrorCode.ERR_OverrideWithConstraints, "where").WithLocation(16, 37),
- // (17,36): error CS0460: Constraints for override and explicit interface implementation methods are inherited from the base method, so they cannot be specified directly
- Diagnostic(ErrorCode.ERR_OverrideWithConstraints, "where").WithLocation(17, 36),
- // (18,45): error CS0460: Constraints for override and explicit interface implementation methods are inherited from the base method, so they cannot be specified directly
- Diagnostic(ErrorCode.ERR_OverrideWithConstraints, "where").WithLocation(18, 45),
- // (19,37): error CS0115: 'B.M4<T>()': no suitable method found to override
- Diagnostic(ErrorCode.ERR_OverrideNotExpected, "M4").WithArguments("B.M4<T>()").WithLocation(19, 37),
- // (19,45): error CS0460: Constraints for override and explicit interface implementation methods are inherited from the base method, so they cannot be specified directly
- Diagnostic(ErrorCode.ERR_OverrideWithConstraints, "where").WithLocation(19, 45));
- }
- [WorkItem(862094, "DevDiv/Personal")]
- [Fact]
- public void CS0514ERR_StaticConstructorWithExplicitConstructorCall()
- {
- var test = @"
- namespace x
- {
- public class clx
- {
- public clx(int i){}
- }
- public class cly : clx
- {
- // static does not have an object, therefore base cannot be called.
- // objects must be known at compiler time
- static cly() : base(0){} // sc0514
- }
- }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_StaticConstructorWithExplicitConstructorCall, "base").WithArguments("cly"));
- }
- [Fact]
- public void CS0514ERR_StaticConstructorWithExplicitConstructorCall2()
- {
- var test = @"
- class C
- {
- C() { }
- static C() : this() { } //CS0514
- }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_StaticConstructorWithExplicitConstructorCall, "this").WithArguments("C"));
- }
- [Fact]
- public void CS0574ERR_BadDestructorName()
- {
- var test = @"
- namespace x
- {
- public class iii
- {
- ~iiii(){}
- public static void Main()
- {
- }
- }
- }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_BadDestructorName, "iiii"));
- }
- // Extra same errors
- [Fact]
- public void CS0650ERR_CStyleArray()
- {
- var test = @"
- public class MyClass
- {
- public static void Main()
- {
- int myarray[2];
- MyClass m[0];
- byte b[13,5];
- double d[14,5,6];
- }
- }
- ";
- ParseAndValidate(test,
- // (6,20): error CS0650: Bad array declarator: To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed size buffer field, use the fixed keyword before the field type.
- // int myarray[2];
- Diagnostic(ErrorCode.ERR_CStyleArray, "[2]"),
- // (6,21): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
- // int myarray[2];
- Diagnostic(ErrorCode.ERR_ArraySizeInDeclaration, "2"),
- // (7,18): error CS0650: Bad array declarator: To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed size buffer field, use the fixed keyword before the field type.
- // MyClass m[0];
- Diagnostic(ErrorCode.ERR_CStyleArray, "[0]"),
- // (7,19): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
- // MyClass m[0];
- Diagnostic(ErrorCode.ERR_ArraySizeInDeclaration, "0"),
- // (8,15): error CS0650: Bad array declarator: To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed size buffer field, use the fixed keyword before the field type.
- // byte b[13,5];
- Diagnostic(ErrorCode.ERR_CStyleArray, "[13,5]"),
- // (8,16): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
- // byte b[13,5];
- Diagnostic(ErrorCode.ERR_ArraySizeInDeclaration, "13"),
- // (8,19): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
- // byte b[13,5];
- Diagnostic(ErrorCode.ERR_ArraySizeInDeclaration, "5"),
- // (9,17): error CS0650: Bad array declarator: To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed size buffer field, use the fixed keyword before the field type.
- // double d[14,5,6];
- Diagnostic(ErrorCode.ERR_CStyleArray, "[14,5,6]"),
- // (9,18): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
- // double d[14,5,6];
- Diagnostic(ErrorCode.ERR_ArraySizeInDeclaration, "14"),
- // (9,21): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
- // double d[14,5,6];
- Diagnostic(ErrorCode.ERR_ArraySizeInDeclaration, "5"),
- // (9,23): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
- // double d[14,5,6];
- Diagnostic(ErrorCode.ERR_ArraySizeInDeclaration, "6") );
- }
- [Fact, WorkItem(535883, "DevDiv")]
- public void CS0687ERR_AliasQualAsExpression()
- {
- var test = @"
- class Test
- {
- public static int Main()
- {
- int i = global::MyType(); // CS0687
- return 1;
- }
- }
- ";
- // Semantic error
- // (6,25): error CS0400: The type or namespace name 'MyType' could not be found in the global namespace (are you missing an assembly reference?)
- CreateCompilationWithMscorlib(test).VerifyDiagnostics(
- Diagnostic(ErrorCode.ERR_GlobalSingleTypeNameNotFound, "MyType").WithArguments("MyType", "<global namespace>")
- );
- }
- [WorkItem(542478, "DevDiv")]
- [Fact]
- public void CS0706ERR_BadConstraintType()
- {
- var source =
- @"interface IA<T, U, V>
- where U : T*
- where V : T[]
- {
- }
- interface IB<T>
- {
- void M<U, V>()
- where U : T*
- where V : T[];
- }";
- CreateCompilationWithMscorlib(source).VerifyDiagnostics(
- // (2,15): error CS0706: Invalid constraint type. A type used as a constraint must be an interface, a non-sealed class or a type parameter.
- Diagnostic(ErrorCode.ERR_BadConstraintType, "T*").WithLocation(2, 15),
- // (3,15): error CS0706: Invalid constraint type. A type used as a constraint must be an interface, a non-sealed class or a type parameter.
- Diagnostic(ErrorCode.ERR_BadConstraintType, "T[]").WithLocation(3, 15),
- // (9,19): error CS0706: Invalid constraint type. A type used as a constraint must be an interface, a non-sealed class or a type parameter.
- Diagnostic(ErrorCode.ERR_BadConstraintType, "T*").WithLocation(9, 19),
- // (10,19): error CS0706: Invalid constraint type. A type used as a constraint must be an interface, a non-sealed class or a type parameter.
- Diagnostic(ErrorCode.ERR_BadConstraintType, "T[]").WithLocation(10, 19),
- // CONSIDER: Dev10 doesn't report these cascading errors.
- // (2,15): error CS0214: Pointers and fixed size buffers may only be used in an unsafe context
- Diagnostic(ErrorCode.ERR_UnsafeNeeded, "T*"),
- // (2,15): error CS0208: Cannot take the address of, get the size of, or declare a pointer to a managed type ('T')
- Diagnostic(ErrorCode.ERR_ManagedAddr, "T*").WithArguments("T"),
- // (9,19): error CS0214: Pointers and fixed size buffers may only be used in an unsafe context
- Diagnostic(ErrorCode.ERR_UnsafeNeeded, "T*"),
- // (9,19): error CS0208: Cannot take the address of, get the size of, or declare a pointer to a managed type ('T')
- Diagnostic(ErrorCode.ERR_ManagedAddr, "T*").WithArguments("T"));
- }
- [Fact]
- public void CS0742ERR_ExpectedSelectOrGroup()
- {
- var test = @"
- using System;
- using System.Linq;
- public class C
- {
- public static int Main()
- {
- int[] array = { 1, 2, 3 };
- var c = from num in array;
- return 1;
- }
- }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_ExpectedSelectOrGroup, ";"));
- }
- [Fact]
- public void CS0743ERR_ExpectedContextualKeywordOn()
- {
- var test = @"
- using System;
- using System.Linq;
- public class C
- {
- public static int Main()
- {
- int[] array1 = { 1, 2, 3 ,4, 5, 6,};
- int[] array2 = { 5, 6, 7, 8, 9 };
- var c = from x in array1
- join y in array2 x equals y
- select x;
- return 1;
- }
- }
- ";
- ParseAndValidate(test, TestOptions.Regular.WithLanguageVersion(LanguageVersion.Experimental),
- // (11,36): error CS0743: Expected contextual keyword 'on'
- // join y in array2 x equals y
- Diagnostic(ErrorCode.ERR_ExpectedContextualKeywordOn, "equals").WithLocation(11, 36),
- // (11,36): error CS1525: Invalid expression term 'equals'
- // join y in array2 x equals y
- Diagnostic(ErrorCode.ERR_InvalidExprTerm, "equals").WithArguments("equals").WithLocation(11, 36));
- }
- [Fact]
- public void CS0743ERR_ExpectedContextualKeywordOn_NoDeclExpr()
- {
- var test = @"
- using System;
- using System.Linq;
- public class C
- {
- public static int Main()
- {
- int[] array1 = { 1, 2, 3 ,4, 5, 6,};
- int[] array2 = { 5, 6, 7, 8, 9 };
- var c = from x in array1
- join y in array2 x equals y
- select x;
- return 1;
- }
- }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_ExpectedContextualKeywordOn, "x"));
- }
- [Fact]
- public void CS0744ERR_ExpectedContextualKeywordEquals()
- {
- var test = @"
- using System;
- using System.Linq;
- public class C
- {
- public static int Main()
- {
- int[] array1 = { 1, 2, 3 ,4, 5, 6,};
- int[] array2 = { 5, 6, 7, 8, 9 };
- var c = from x in array1
- join y in array2 on x y
- select x;
- return 1;
- }
- }
- ";
- ParseAndValidate(test, TestOptions.Regular.WithLanguageVersion(LanguageVersion.Experimental),
- // (11,40): error CS0744: Expected contextual keyword 'equals'
- // join y in array2 on x y
- Diagnostic(ErrorCode.ERR_ExpectedContextualKeywordEquals, "").WithLocation(11, 40),
- // (11,40): error CS1525: Invalid expression term 'select'
- // join y in array2 on x y
- Diagnostic(ErrorCode.ERR_InvalidExprTerm, "").WithArguments("select").WithLocation(11, 40));
- }
- [Fact]
- public void CS0744ERR_ExpectedContextualKeywordEquals_NoDeclExpr()
- {
- var test = @"
- using System;
- using System.Linq;
- public class C
- {
- public static int Main()
- {
- int[] array1 = { 1, 2, 3 ,4, 5, 6,};
- int[] array2 = { 5, 6, 7, 8, 9 };
- var c = from x in array1
- join y in array2 on x y
- select x;
- return 1;
- }
- }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_ExpectedContextualKeywordEquals, "y"));
- }
- [WorkItem(862121, "DevDiv/Personal")]
- [Fact]
- public void CS0745ERR_ExpectedContextualKeywordBy()
- {
- var test = @"
- using System;
- using System.Linq;
- public class C
- {
- public static int Main()
- {
- int[] array1 = { 1, 2, 3 ,4, 5, 6,};
- int[] array2 = { 5, 6, 7, 8, 9 };
- var c = from x in array1
- join y in array2 on x equals y
- group x y;
- return 1;
- }
- }
- ";
- ParseAndValidate(test, TestOptions.Regular.WithLanguageVersion(LanguageVersion.Experimental),
- // (12,26): error CS0745: Expected contextual keyword 'by'
- // group x y;
- Diagnostic(ErrorCode.ERR_ExpectedContextualKeywordBy, ";").WithLocation(12, 26),
- // (12,26): error CS1525: Invalid expression term ';'
- // group x y;
- Diagnostic(ErrorCode.ERR_InvalidExprTerm, ";").WithArguments(";").WithLocation(12, 26));
- }
- [WorkItem(862121, "DevDiv/Personal")]
- [Fact]
- public void CS0745ERR_ExpectedContextualKeywordBy_NoDeclExpr()
- {
- var test = @"
- using System;
- using System.Linq;
- public class C
- {
- public static int Main()
- {
- int[] array1 = { 1, 2, 3 ,4, 5, 6,};
- int[] array2 = { 5, 6, 7, 8, 9 };
- var c = from x in array1
- join y in array2 on x equals y
- group x y;
- return 1;
- }
- }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_ExpectedContextualKeywordBy, "y"));
- }
- [Fact]
- public void CS0746ERR_InvalidAnonymousTypeMemberDeclarator()
- {
- var test = @"
- using System;
- public class C
- {
- public static int Main()
- {
- int i = 1;
- var t = new { a.b = 1 };
- return 1;
- }
- }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_InvalidAnonymousTypeMemberDeclarator, "a.b = 1"));
- }
- [Fact]
- public void CS0746ERR_InvalidAnonymousTypeMemberDeclarator_2()
- {
- var test = @"
- using System;
- public class C
- {
- public static void Main()
- {
- string s = """";
- var t = new { s.Length = 1 };
- }
- }
- ";
- ParseAndValidate(test,
- // (8,23): error CS0746: Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access.
- // var t = new { s.Length = 1 };
- Diagnostic(ErrorCode.ERR_InvalidAnonymousTypeMemberDeclarator, "s.Length = 1"));
- }
- [Fact]
- public void CS0746ERR_InvalidAnonymousTypeMemberDeclarator_3()
- {
- var test = @"
- using System;
- public class C
- {
- public static void Main()
- {
- string s = """";
- var t = new { s.ToString() = 1 };
- }
- }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_InvalidAnonymousTypeMemberDeclarator, "s.ToString() = 1"));
- }
- [Fact]
- public void CS0748ERR_InconsistentLambdaParameterUsage()
- {
- var test = @"
- class C
- {
- delegate T Func<T>();
- delegate T Func<A0, T>(A0 a0);
- delegate T Func<A0, A1, T>(A0 a0, A1 a1);
- delegate T Func<A0, A1, A2, A3, T>(A0 a0, A1 a1, A2 a2, A3 a3);
- static void X()
- {
- Func<int,int> f1 = (int x, y) => 1; // err: mixed parameters
- Func<int,int> f2 = (x, int y) => 1; // err: mixed parameters
- Func<int,int> f3 = (int x, int y, z) => 1; // err: mixed parameters
- Func<int,int> f4 = (int x, y, int z) => 1; // err: mixed parameters
- Func<int,int> f5 = (x, int y, int z) => 1; // err: mixed parameters
- Func<int,int> f6 = (x, y, int z) => 1; // err: mixed parameters
- }
- }
- ";
- ParseAndValidate(test,
- // (10,41): error CS0748: Inconsistent lambda parameter usage; parameter types must be all explicit or all implicit
- // Func<int,int> f1 = (int x, y) => 1; // err: mixed parameters
- Diagnostic(ErrorCode.ERR_InconsistentLambdaParameterUsage, "y"),
- // (11,37): error CS0748: Inconsistent lambda parameter usage; parameter types must be all explicit or all implicit
- // Func<int,int> f2 = (x, int y) => 1; // err: mixed parameters
- Diagnostic(ErrorCode.ERR_InconsistentLambdaParameterUsage, "int"),
- // (12,48): error CS0748: Inconsistent lambda parameter usage; parameter types must be all explicit or all implicit
- // Func<int,int> f3 = (int x, int y, z) => 1; // err: mixed parameters
- Diagnostic(ErrorCode.ERR_InconsistentLambdaParameterUsage, "z"),
- // (13,41): error CS0748: Inconsistent lambda parameter usage; parameter types must be all explicit or all implicit
- // Func<int,int> f4 = (int x, y, int z) => 1; // err: mixed parameters
- Diagnostic(ErrorCode.ERR_InconsistentLambdaParameterUsage, "y"),
- // (14,37): error CS0748: Inconsistent lambda parameter usage; parameter types must be all explicit or all implicit
- // Func<int,int> f5 = (x, int y, int z) => 1; // err: mixed parameters
- Diagnostic(ErrorCode.ERR_InconsistentLambdaParameterUsage, "int"),
- // (14,44): error CS0748: Inconsistent lambda parameter usage; parameter types must be all explicit or all implicit
- // Func<int,int> f5 = (x, int y, int z) => 1; // err: mixed parameters
- Diagnostic(ErrorCode.ERR_InconsistentLambdaParameterUsage, "int"),
- // (15,40): error CS0748: Inconsistent lambda parameter usage; parameter types must be all explicit or all implicit
- // Func<int,int> f6 = (x, y, int z) => 1; // err: mixed parameters
- Diagnostic(ErrorCode.ERR_InconsistentLambdaParameterUsage, "int"));
- }
- [WorkItem(535915, "DevDiv")]
- [Fact]
- public void CS0839ERR_MissingArgument()
- {
- // Diff error
- var test = @"
- using System;
- namespace TestNamespace
- {
- class Test
- {
- static int Add(int i, int j)
- {
- return i + j;
- }
- static int Main()
- {
- int i = Test.Add(
- ,
- 5);
- return 1;
- }
- }
- }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_MissingArgument, ""));
- }
- [WorkItem(863064, "DevDiv/Personal")]
- [Fact]
- public void CS1001ERR_IdentifierExpected()
- {
- var test = @"
- public class clx
- {
- enum splitch
- {
- 'a'
- }
- }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_IdentifierExpected, ""));
- }
- [Fact, WorkItem(542408, "DevDiv")]
- public void CS1001ERR_IdentifierExpected_2()
- {
- var test = @"
- enum
- ";
- ParseAndValidate(test,
- Diagnostic(ErrorCode.ERR_IdentifierExpected, ""),
- Diagnostic(ErrorCode.ERR_LbraceExpected, ""),
- Diagnostic(ErrorCode.ERR_RbraceExpected, ""));
- }
- [Fact, WorkItem(542408, "DevDiv")]
- public void CS1001ERR_IdentifierExpected_5()
- {
- var test = @"
- using System;
- struct
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_IdentifierExpected, ""),
- Diagnostic(ErrorCode.ERR_LbraceExpected, ""),
- Diagnostic(ErrorCode.ERR_RbraceExpected, ""));
- }
- [Fact, WorkItem(542416, "DevDiv")]
- public void CS1001ERR_IdentifierExpected_3()
- {
- var test = @"
- using System;
- class NamedExample
- {
- static void Main(string[] args)
- {
- ExampleMethod(3, optionalint:4);
- }
- static void ExampleMethod(int required, string 1 = ""default string"",int optionalint = 10)
- { }
- }
- ";
- ParseAndValidate(test,
- // (9,52): error CS1001: Identifier expected
- // static void ExampleMethod(int required, string 1 = "default string",int optionalint = 10)
- Diagnostic(ErrorCode.ERR_IdentifierExpected, "1"),
- // (9,52): error CS1003: Syntax error, ',' expected
- // static void ExampleMethod(int required, string 1 = "default string",int optionalint = 10)
- Diagnostic(ErrorCode.ERR_SyntaxError, "1").WithArguments(",", ""));
- }
- [Fact, WorkItem(542416, "DevDiv")]
- public void CS1001ERR_IdentifierExpected_4()
- {
- var test = @"
- using System;
- class NamedExample
- {
- static void Main(string[] args)
- {
- ExampleMethod(3, optionalint:4);
- }
- static void ExampleMethod(int required, ,int optionalint = 10)
- { }
- }
- ";
- // Extra errors
- ParseAndValidate(test,
- // (9,45): error CS1031: Type expected
- // static void ExampleMethod(int required, ,int optionalint = 10)
- Diagnostic(ErrorCode.ERR_TypeExpected, ","),
- // (9,45): error CS1001: Identifier expected
- // static void ExampleMethod(int required, ,int optionalint = 10)
- Diagnostic(ErrorCode.ERR_IdentifierExpected, ","));
- }
- [Fact, WorkItem(542416, "DevDiv")]
- public void CS1001ERR_IdentifierExpected_6()
- {
- var test = @"
- class Program
- {
- const int max = 10;
- static void M(int p2 = max is int?1,)
- {
- }
- static void Main()
- {
- M(1);
- }
- }
- ";
- // Extra errors
- ParseAndValidate(test,
- // (5,40): error CS1003: Syntax error, ':' expected
- // static void M(int p2 = max is int?1,)
- Diagnostic(ErrorCode.ERR_SyntaxError, ",").WithArguments(":", ","),
- // (5,40): error CS1525: Invalid expression term ','
- // static void M(int p2 = max is int?1,)
- Diagnostic(ErrorCode.ERR_InvalidExprTerm, ",").WithArguments(","),
- // (5,41): error CS1031: Type expected
- // static void M(int p2 = max is int?1,)
- Diagnostic(ErrorCode.ERR_TypeExpected, ")"),
- // (5,41): error CS1001: Identifier expected
- // static void M(int p2 = max is int?1,)
- Diagnostic(ErrorCode.ERR_IdentifierExpected, ")"));
- }
- [Fact]
- public void CS1002ERR_SemicolonExpected()
- {
- var test = @"
- namespace x {
- abstract public class clx
- {
- int i // CS1002, missing semicolon
- public static int Main()
- {
- return 0;
- }
- }
- }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_SemicolonExpected, ""));
- }
- [WorkItem(528008, "DevDiv")]
- [Fact]
- public void CS1002ERR_SemicolonExpected_2()
- {
- var test = @"
- class Program
- {
- static void Main(string[] args)
- {
- goto Lab2,Lab1;
- Lab1:
- System.Console.WriteLine(""1"");
- Lab2:
- System.Console.WriteLine(""2"");
- }
- }
- ";
- ParseAndValidate(test,
- // (6,18): error CS1002: ; expected
- // goto Lab2,Lab1;
- Diagnostic(ErrorCode.ERR_SemicolonExpected, ","),
- // (6,18): error CS1513: } expected
- // goto Lab2,Lab1;
- Diagnostic(ErrorCode.ERR_RbraceExpected, ","));
- }
- [WorkItem(527944, "DevDiv")]
- [Fact]
- public void CS1002ERR_SemicolonExpected_3()
- {
- var test = @"
- class Program
- {
- static void Main(string[] args)
- {
- goto L1;
- return;
- L1: //invalid
- }
- }
- ";
- ParseAndValidate(test,
- // (8,8): error CS1525: Invalid expression term '}'
- // L1: //invalid
- Diagnostic(ErrorCode.ERR_InvalidExprTerm, "").WithArguments("}"),
- // (8,8): error CS1002: ; expected
- // L1: //invalid
- Diagnostic(ErrorCode.ERR_SemicolonExpected, ""));
- }
- [Fact()]
- public void CS1002ERR_SemicolonExpected_4()
- {
- var test = @"
- class Program
- {
- static void Main(string[] args)
- {
- string target = ""t1"";
- switch (target)
- {
- label1:
- case ""t1"":
- goto label1;
- }
- }
- }
- ";
- // Extra errors
- ParseAndValidate(test,
- // (8,10): error CS1513: } expected
- // {
- Diagnostic(ErrorCode.ERR_RbraceExpected, ""),
- // (9,16): error CS1525: Invalid expression term 'case'
- // label1:
- Diagnostic(ErrorCode.ERR_InvalidExprTerm, "").WithArguments("case"),
- // (9,16): error CS1002: ; expected
- // label1:
- Diagnostic(ErrorCode.ERR_SemicolonExpected, ""),
- // (9,16): error CS1513: } expected
- // label1:
- Diagnostic(ErrorCode.ERR_RbraceExpected, ""),
- // (10,18): error CS1002: ; expected
- // case "t1":
- Diagnostic(ErrorCode.ERR_SemicolonExpected, ":"),
- // (10,18): error CS1513: } expected
- // case "t1":
- Diagnostic(ErrorCode.ERR_RbraceExpected, ":"),
- // (14,1): error CS1022: Type or namespace definition, or end-of-file expected
- // }
- Diagnostic(ErrorCode.ERR_EOFExpected, "}"));
- }
- // TODO: diff error CS1525 vs. CS1513
- [Fact]
- public void CS1003ERR_SyntaxError()
- {
- var test = @"
- namespace x
- {
- public class b
- {
- public static void Main() {
- int[] a;
- a[);
- }
- }
- }
- ";
- ParseAndValidate(test,
- // (8,15): error CS1003: Syntax error, ']' expected
- // a[);
- Diagnostic(ErrorCode.ERR_SyntaxError, ")").WithArguments("]", ")"),
- // (8,15): error CS1002: ; expected
- // a[);
- Diagnostic(ErrorCode.ERR_SemicolonExpected, ")"),
- // (8,15): error CS1513: } expected
- // a[);
- Diagnostic(ErrorCode.ERR_RbraceExpected, ")"));
- }
- [Fact]
- public void CS1003ERR_SyntaxError_ForeachExpected1()
- {
- var test = @"
- public class b
- {
- public void Main()
- {
- for (var v in
- }
- }
- ";
- //the first error should be
- // (6,9): error CS1003: Syntax error, 'foreach' expected
- // don't care about any others.
- var parsedTree = ParseWithRoundTripCheck(test);
- var firstDiag = parsedTree.GetDiagnostics().Take(1);
- firstDiag.Verify(Diagnostic(ErrorCode.ERR_SyntaxError, "for").WithArguments("foreach", "for"));
- }
- [Fact]
- public void CS1004ERR_DuplicateModifier()
- {
- var test = @"
- namespace x {
- abstract public class clx
- {
- int i;
- public public static int Main() // CS1004, two public keywords
- {
- return 0;
- }
- }
- }
- ";
- ParseAndValidate(test, Diagnostic(ErrorCode.ERR_DuplicateModifier, "public").WithArguments("public"));
- }
- [Fact]
- public void CS1007ERR_DuplicateAccessor()
- {
- var test = @"using System;
- public class Container
- {
- public int Prop1{ protected get{return 1;} set {} protected get { return 1;} }
- public static int Prop2{ get{return 1;} internal set {} internal set{} }
- public int this[int i]{ protected get{return 1;} internal set {} protected get { return 1;} internal set {} }
- }
- ";
- ParseAndValidate(test,
- // (5,65): error CS1007: Property accessor already defined
- // public int Prop1{ protected get{return 1;} set {} protected get { return 1;} }
- Diagnostic(ErrorCode.ERR_DuplicateAccessor, "get"),
- // (6,70): error CS1007: Property ac…
Large files files are truncated, but you can click here to view the full file