Errore del compilatore CS0633

Aggiornamento: novembre 2007

Messaggio di errore

L'argomento dell'attributo 'attributo' deve essere un identificatore valido.
The argument to the 'attribute' attribute must be a valid identifier

Gli argomenti passati all'attributo ConditionalAttribute o IndexerNameAttribute devono essere identificatori validi. Non possono quindi contenere caratteri non consentiti per gli identificatori, ad esempio "+".

Esempio

Nell'esempio riportato di seguito viene generato l'errore CS0633 utilizzando ConditionalAttribute. Il seguente codice di esempio genera l'errore 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() { }
}

Nell'esempio riportato di seguito viene generato l'errore CS0633 utilizzando 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; } 
   }
}