Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0633

The argument to the 'attribute' attribute must be a valid identifier

Any argument that you pass to the ConditionalAttribute or IndexerNameAttribute attributes must be a valid identifier. This means that it may not contain characters such as "+" that are illegal when they occur in identifiers.

This example illustrates CS0633 using the ConditionalAttribute. The following sample generates CS0633.

// CS0633a.cs
#define DEBUG
using System.Diagnostics;
public class Test
{
   [Conditional("DEB+UG")]   // CS0633
   // try the following line instead
   // [Conditional("DEBUG")]
   public static void Main() { }
}

This example illustrates CS0633 using the IndexerNameAttribute.

// CS0633b.cs
// compile with: /target:module
#define DEBUG
using System.Runtime.CompilerServices;
public class Test
{
   [IndexerName("Invalid+Identifier")]   // CS0633
   // try the following line instead
   // [IndexerName("DEBUG")]
   public int this[int i] 
   { 
      get { return i; } 
   }
}

Community Additions

ADD
Show:
© 2015 Microsoft