Expand To Show Full Article
C# Error CS0633 - The argument to the '{0}' attribute must be a valid identifier - Developer Publish

C# Error CS0633 – The argument to the ‘{0}’ attribute must be a valid identifier

C# Error

CS0633 – The argument to the ‘{0}’ attribute must be a valid identifier

Reason for the Error & Solution

The argument to the ‘attribute’ attribute must be a valid identifier

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

Example 1

This example illustrates CS0633 using the . 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() { }  
}  

Example 2

This example illustrates CS0633 using the .

// 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; }
   }  
}