-
Notifications
You must be signed in to change notification settings - Fork 8
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
GCop628 false alarm #300
Comments
@sungam3r Hi. Its weird b.c I'm not getting the same warning message on the same code. Here is the warning I'm getting : GCop628: Maybe define this method on 'DoSome' class as it's using 1 of its members (compared to 0 from this type) Would you please provide the entire class your working on? |
<PackageReference Include="GCop.All.Common" Version="2.6.0" PrivateAssets="all" /> using System.Threading.Tasks;
namespace Test
{
internal class Class1
{
public Task DoSome(int? value) // GCop628: Maybe define this method on 'Nullable' class as it's using 1 of its members (compared to 0 from this type)
{
if (value.HasValue)
return Task.CompletedTask;
return null;
}
}
} |
Even with using the exact version, I couldn't find this issue. Not in unit tests, not in a real scenario. Unit test result : @marjanjavid @Karvan Would you please you guys have a look if you can find the issue on this one ? |
Obviously, we cannot move the method inside
System.Nullable<T>
. The rule should take into account the system types. Also note if you make the method static, then there is no warning.The text was updated successfully, but these errors were encountered: