开发者

VS2008 C# compiler error: "'.ctor' is not supported by the language"

I received this error from the C# compiler in VS2008. Googling it has turned up nothing useful. I've never seen this error before. Can anyone shed some light on it?

The line of code in question is the instantiation of a class I define:

Frame frame = new Frame( // various arguments...

Yes, the constructor exists. If it didn't, it would be an entirely different error. There are no o开发者_JAVA百科ther compilation errors. This is the only point in the project where this class is instantiated. I'm more curious than anything at this point.

(edit) By request, the class constructor definitions:

This is the one I'm calling:

public Frame(int startTime, int length, byte commandId)

The other one takes an object as a parameter. That object contains the data provided by the other constructor:

public Frame(Command command)

The referenced Command class is defined in a separate assembly that is referenced and does compile without error.


I think I found the answer. Or, at least, the cause of this specific error.

I started looking at the files involved and checking for anything out-of-date or other inconsistencies. One of the assemblies was dated in the past. VS would build it without error, but the target file's modified date would not change. It wasn't until I deleted that assembly manually and rebuilt it did an up-to-date binary appear.

After that, I stopped receiving the compiler error message.


Is Frame defined in a C++/CLI assembly? If so, the constructor could contain parameters not supported by the C# compiler.


Reslove error build **"Is not supported by the language"** in Visual studio

Clear old file .DLL and rebuild project
+ Remove old .dll file in current project
+ Re add reference new file .dll into project

Why?
Because, when update new reference, then you may be conflict (duplicate dll) in project
1. DLL old in current project and
2.DLL just add new reference.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜