编译器警告(等级 2)CS3019

更新:2007 年 11 月

错误消息

CLS 遵从性检查不会在“type”上执行,因为它在此程序集的外部不可见。

当一个具有 CLSCompliantAttribute 属性的类型或成员从另一个程序集中不可见时,将出现此警告。若要解决此错误,请移除从其他程序集中不可见的所有类或成员的属性,或者使类型或成员可见。有关 CLS 遵从性的更多信息,请参见编写符合 CLS 的代码

示例

下面的示例生成 CS3019:

// CS3019.cs
// compile with: /W:2

using System;

[assembly: CLSCompliant(true)]

// To fix the error, remove the next line
[CLSCompliant(true)]  // CS3019
class C
{
    [CLSCompliant(false)]  // CS3019
    void Foo()
    {
    }

    static void Main()
    {
    }
}

请参见

概念

公共语言规范