Errore del compilatore CS0570

Aggiornamento: novembre 2007

Messaggio di errore

La proprietà, l'indicizzatore o l'evento 'name' non è supportato dal linguaggio. Provare a chiamare direttamente il metodo della funzione di accesso 'name'
Property, indexer, or event 'name' is not supported by the language; try directly calling accessor method 'name!'

Questo errore si verifica quando si utilizzano metadati importati generati da un altro compilatore. Il codice ha tentato di utilizzare un membro di classe che non può essere elaborato dal compilatore.

Esempio

Nel seguente programma C++ viene utilizzato un attributo RequiredAttributeAttribute, che potrebbe non essere utilizzabile in altri linguaggi.

// CPP0570.cpp
// compile with: /clr /LD

using namespace System;
using namespace System::Runtime::CompilerServices;

namespace CS0570_Server {
   [RequiredAttributeAttribute(Int32::typeid)]  
   public ref struct Scenario1 {
      int intVar;
   };

   public ref struct CS0570Class {
      Scenario1 ^ sc1_field;

      property virtual Scenario1 ^ sc1_prop {
         Scenario1 ^ get() { return sc1_field; }
      }

      Scenario1 ^ sc1_method() { return sc1_field; }
   };
};

Il seguente codice di esempio genera l'errore CS0570:

// CS0570.cs
// compile with: /reference:CPP0570.dll
using System;
using CS0570_Server;

public class C {
   public static int Main() {
      CS0570Class r = new CS0570Class();
      r.sc1_field = null;   // CS0570
      object o = r.sc1_prop;   // CS0570
      r.sc1_method();   // CS0570
   }
}