This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 151
Bad application of visibility rules on method parameter attributes? #273
Comments
@roji interesting question:) Can you show simple workable example? I'm really surprised with this behavior... |
Here's a minimal example: public class Program
{
static void Main(string[] args)
{
}
public static void Foo([MyAttr] string s)
{
Contract.Requires(s.StartsWith("yo"));
}
}
internal class MyAttr : Attribute {} Trying to compile this with runtime contract checking fails with the following error:
|
Thanks a lot! This sounds like a bug to me. |
SergeyTeplyakov
added a commit
to SergeyTeplyakov/CodeContracts
that referenced
this issue
Oct 26, 2015
SergeyTeplyakov
added a commit
to SergeyTeplyakov/CodeContracts
that referenced
this issue
Oct 26, 2015
New PR is #280. |
Am trying to build CC to test this, but am getting the following when trying to build "Abstract Domains":
|
You must be building it in Visual Studio 2015 and you are hitting #186. |
@roji Are you still hitting this issue? Is it related to VS2015 as @fedotovalex suggested or not? |
I can confirm I'm on VS2015, I don't have an earlier version around to test on... |
@roji Yeah, sorry for that, but currently the build will break on VS2015. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm using Jetbrains Code Annotations in a library which also uses Code Contracts. I'm annotating parameters on some public methods with [NotNull] and [CanBeNull] attributes, but the CC rewriter complains about visibility:
Now, it's true that I'm trying to apply an internal attribute (e.g. [NotNull]) to a public method. But why should this be a problem for CC? Shouldn't it be perfectly fine to have an internal attribute meant purely for internal consumption on a public method's parameters?
The text was updated successfully, but these errors were encountered: