Duplicate attribute errors - seem unreasonable
Answered
Suddenly Rider will underline and warn me of errors every time I "duplicate" attributes, even when those attributes are commonly duplicated. They don't cause build errors, only an annoying red underline that makes real problems difficult to find.
Here are a couple of examples of code that produce the errors:
[Theory]
[InlineData(1)] // "Duplicate 'InlineDataAttribute' attribute"
[InlineData(2)] // "Duplicate 'InlineDataAttribute' attribute"
public void Test(int input)
{
// ...
}
[HttpGet]
[ProducesResponseType(StatusCodes.Status200OK)] // "Duplicate 'ProducesResponseTypeAttribute' attribute"
[ProducesResponseType(StatusCodes.Status401Unauthorized)] // "Duplicate 'ProducesResponseTypeAttribute' attribute"
public IActionResult MyAction()
{
// ...
}
How can I stop rider from showing these as errors? I realize I can ignore them from the Errors In Solution menu, but that doesn't stop the underlining.
Please sign in to leave a comment.
I'm having the same issue with
Hi Jake, Patrik,
thank you for contacting us.
It seems like there are different errors, but please, try first to update to the latest release and check if this helps.
Please, let me know if the problem persists.
Updating to 2019.3 seems to fix this problem for me.
I have the same problem and I'm running JetBrains Rider 2019.3.1 on MacOS (Build: RD-193-5662.14).
I'm also having the same problem with JetBrains Rider 2019.3.1 on MacOS (Build: RD-193-5662.14).
I have started getting this issue in Visual Studio 2019 Professional with ReSharper Ultimate 2019.3.1 Build 193.0.20191219.91525
EDIT: After a brief back and forth with support, the recommendation of clearing the Resharper cache in VS 2019 16.4.3 worked. ReSharper | Options | Environment | General | Clear caches
I am having the same issue. Like Rasc, I am also seeing it with `Nunit.Framework.TestCase`.
Rider Version: 2019.3.1
Build #: RD-193.5662.14
JRE 11.0.5 10-b520.17x64 JetBrains s.r.o
OS: Arch Linux(amd64) v5.4.11-arch1-1
I have the same problem, using Visual Studio 2019 16.4.3 with ReSharper 2019.3.1:
This results in two errors "Duplicate 'ProducesResponseTypeAttribute' attribute".
Alexandra Guk: Any news on this? It does not seem to be fixed in the latest release...
This started happening to me immediately after upgrading VS 2019 from version 16.4.2 to 16.4.3.
This affects both VS 2019 and Rider JetBrains Rider 2019.3.1, Build #RD-193.5662.14, built on December 19, 2019
I have the same problem as Gakk - with the same versions of VS and ReSharper.
Same here. Started after upgrading to VS 16.4.3
Upgrade your NUnit nuget package from 3.11 to 3.12. Resolved the issue for me.
I'm not even using NUnit. I'm getting the warning on Swashbuckle attributes
Hello everyone,
We're investigating the problem. As a workaround, please use "ReSharper | Options | Environment | General | Clear caches" for ReSharper.
For Rider: try clearing caches via "File | Invalidate caches and restart".
Sorry for the inconvenience!
Clearing the cache solved the problem for R# 2019.3.1
Mattias, thank you for letting us know!
This issue persist on Ubuntu 16.04 Rider version 2019.3, build 193-5662-14 built on December 19, 2019.
It happens with ProducesResponseType as well as SuppressMessage
Radoslaw Jurewicz oh, sorry. For Rider: please try clearing caches via "File | Invalidate caches and restart". Does it help?
Maria Pleskunina thank you very much, it works!
Hi,
If any of you noticed that the problem reappears some time after clearing the caches and wants to try a private build, then here you are:
ReSharper private build
Rider, Windows private build
Rider, Mac private build
Rider, Linux private build
Please let us know how it works for you.
Clear caches solved the problem for me too.
Hello everyone!
ReSharper 2019.3.2 and Rider 2019.3.2 are released, please try installing this update and let us know if there are any problems.
Still having the same issue.
JetBrains Rider 2020.1.2
Build #RD-201.7223.10, built on May 6, 2020
Runtime version: 11.0.6+8-b765.40 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
.NET Core 3.1.3
Linux 5.4.0-29-generic
Edit:
Nevermind, clearing caches like Maria described above helped.
Still a weird issue as this "duplicate attribute" issue just appeared today after installing .NET Core on 20.04 using the repository released by Microsoft today.
@... thank you for letting us know that the problem has been solved. I'll try to reproduce it. Thank you!
@..., please notify us if the problem happens again after clearing the caches.
I am seeing the same issue after running the "Invalidate Caches / Restart". Tried it twice. Thanks!
@Timothy White thanks for the update! That is, do I understand correctly that this doesn't help you even temporarily?
What Rider version are you using (Help | About)?
Well the project compiles - so I can just ignore the red squiggles, but it looks like there are a ton of errors. Thanks!
This is happening to me on a fresh install of the latest version of Rider. It's installed in my Windows Subsystem for Linux 2 Ubuntu distro. It's preventing my project from compiling because it's detecting errors in my EF Core Migrations folder. Clearing cache didn't work
`20200907194423_Initial.Designer.cs(12, 6): [CS0579] Duplicate 'DbContext' attribute`
`20200907194423_Initial.Designer.cs(13, 6): [CS0579] Duplicate 'Migration' attribute`
` 20200907194423_Initial.cs(8, 33): [CS0111] Type 'Initial' already defines a member called 'Up' with the same parameter types`
` 20200907194423_Initial.cs(54, 33): [CS0111] Type 'Initial' already defines a member called 'Down' with the same parameter types`
` 20200907194423_Initial.Designer.cs(16, 33): [CS0111] Type 'Initial' already defines a member called 'BuildTargetModel' with the same parameter types`