컴파일러 오류 CS0570

오류 메시지

'class'은(는) 언어에서 지원되지 않습니다.
'class' is not supported by the language

이 오류는 다른 컴파일러에서 생성한 메타데이터를 가져와서 사용하는 경우 발생합니다. 컴파일러에서 처리할 수 없는 클래스 멤버를 코드에서 사용하려고 했습니다.

예제

다음 C++ 프로그램에서는 다른 언어가 사용할 수 없는 RequiredAttributeAttribute 특성을 사용합니다.

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

다음 샘플에서는 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
   }
}