-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLS Compliance warning CS3016 is reported on non-public members #4293
Comments
dotnet/roslyn#4293 CLS Compliance warning CS3016 is reported on non-public members
The behavior is consistent with behavior of VS2013 compiler. Moving to 2.0. I am not sure if it is worth changing the behavior at all. |
dotnet/roslyn#4293 CLS Compliance warning CS3016 is reported on non-public members
* Use ReaderWriterLockSlim * Move duplicated code into common folder * Use EmptyArray<T> instead of new T[0] * Fix CLS Compliance error in System.Composition test library (See dotnet/roslyn#4293: CLS Compliance warning CS3016 is reported on non-public members) * Rename SilverlightTraceWriter.cs to DebuggerTraceWriter.cs * Use CommonPath build property to include common files * Remove unnecessary AssemblyInfo.cs files * Remove unused private constant in System.Composition.AttributedModel
* Use ReaderWriterLockSlim * Move duplicated code into common folder * Use EmptyArray<T> instead of new T[0] * Fix CLS Compliance error in System.Composition test library (See dotnet/roslyn#4293: CLS Compliance warning CS3016 is reported on non-public members) * Rename SilverlightTraceWriter.cs to DebuggerTraceWriter.cs * Use CommonPath build property to include common files * Remove unnecessary AssemblyInfo.cs files * Remove unused private constant in System.Composition.AttributedModel
* Use ReaderWriterLockSlim * Move duplicated code into common folder * Use EmptyArray<T> instead of new T[0] * Fix CLS Compliance error in System.Composition test library (See dotnet/roslyn#4293: CLS Compliance warning CS3016 is reported on non-public members) * Rename SilverlightTraceWriter.cs to DebuggerTraceWriter.cs * Use CommonPath build property to include common files * Remove unnecessary AssemblyInfo.cs files * Remove unused private constant in System.Composition.AttributedModel
Have you tried |
@AlekseyTs if it's consistent with native compiler I agree at least 2.0. However is this a bug or "by design"? If it's a bug I'd like to keep for fixing, if not though I'd like to close it out. |
@jaredpar As far as I know, there is no compiler spec for CLS Compliance that we can refer to. For Roslyn, our goal regarding CLS Compliance was to duplicate native compiler behavior. So, it is everyone's judgement call whether this is by design or a bug. Regardless, in my personal opinion, it is not worth changing the behavior in this area. CC @amcasey |
As @AlekseyTs said, when we implemented this, we found ourselves in a tight spot - the rules aren't strict enough to ensure that APIs will work across language enough, but strengthening them would have broken existing programs. While I hope that eventually we will be able to implement stronger rules as analyzers, our present goal is to mimic dev12 on a best-effort basis, favoring fewer, rather than more, diagnostics. |
Given the constraints here I agree with Close / Won't fix. Thanks! |
Compile the following code:
EXPECTED: No warnings
ACTUAL: warning CS3016: Arrays as attribute arguments is not CLS-compliant
If you try to disable the warning by putting
[CLSCompliant(false)]
on theLightweightWebBenchmark
class (or itsWebScopeFactory
property), you get this error:So for code like this it doesn't appear possible to avoid CLS compliance warnings, without disabling CLS compliance for the whole assembly or using specifically ignoring this warning.
The text was updated successfully, but these errors were encountered: