Compiler Error CS0570
Visual Studio 2008
Property, indexer, or event 'name' is not supported by the language; try directly calling accessor method 'name!'
This error occurs when using imported metadata that was generated by another compiler. Your code attempted to use a class member that the compiler cannot process.
The following C++ program uses an attribute, RequiredAttributeAttribute, which may not be consumed by other languages.
// 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; }
};
};
The following sample generates 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
}
}
C# error CS0570: 'foo' is not supported by the language
For future visitors, this error popped up for me on a mixed mode operation. I have a 3rd party dll, wrapped by CLI/C++ with the following code:
virtual uint32 load_dataSets(DataPacketWrap% dataPacket) new
{
...
};
To fix the error, I added the ^ symbol to the signature:
virtual uint32 load_dataSets(DataPacketWrap^% dataPacket) new
That is all it took for me to fix the issue.
T.
virtual uint32 load_dataSets(DataPacketWrap% dataPacket) new
{
...
};
To fix the error, I added the ^ symbol to the signature:
virtual uint32 load_dataSets(DataPacketWrap^% dataPacket) new
That is all it took for me to fix the issue.
T.
- 7/24/2009
- willthethrill