Getting ambiguous reference error
Completed
Hi;
I am getting the red squiggly line under class references for variables saying it's an ambiguous reference. First I was getting it in my test project. Now in the main project too. I am 99% certain I have no ambiguous references.
I have cleared the cache, closed VisualStudio, deleted all obj & bin folders, started VisualStudio - and still have it.
Everything compiles & runs fine.
What's going on?
thanks - dave
Please sign in to leave a comment.
Hi David, thank you for your feedback. First of all - what VS and ReSharper versions are you using?
If this is reproducible in the latest ReSharper 2022.1 in a test project, can you send it to us for investigation? You can use https://uploads.jetbrains.com/ for this. Thanks in advance!
I updated to 2022.1 and that fixed it.
Thank you
I've been getting the ambiguous reference warning for about 6 months now. Every update to VS2022 and/or Resharper brings me hope that it is fixed. Sadly, I'm disappointed. I seem to get them in the code behind for every object defined in a XAML file. Here is an example:
I don't understand where the ambiguity lies.
I am running VS2022 Version 17.2.1 (64-bit) and Resharper 2022.1.1 built on 2022-04-28.
Hello Culpepperj,
Does the issue go away if you disable ReSharper?
Is there any chance you could provide us some stripped solution in which the problem is reproduced? You can send it using our "Submit a request" form at the top of the page.
Thank you.
Same issue. It goes away in VS2019 once ReShaper is disabled
thank you for contacting us.
What version of ReSharper are you using?
Does it happen in all solutions or only in specific one?
Thank you!
Hello, RS version is 2022.3.1
It seems that all solutions are affected with cross-references to Projects to share a code base.
please try to turn off option: ReSharper | Options | Environment | General | Read solution model directly
That fixed it for me. After changing the setting, all Ambiguous References have gone away. Thank you both for the solution.
Sorry. I spoke too soon. After rebuilding my solution, the Ambiguous References returned regardless of how the "Read solution model directly" is checked in the options.
Sometimes it helps to disable RS, clean and rebuild the solution, then enable RS and after restart the Ambiguos References error disappears.
That appears to do the trick. Thanks again for the solution.
I saw the above successful results on a project that was based on .Net 7. This project had been converted from .Net Framework 4.7. Today, I went back to the original .Net Framework project and saw all of the Ambiguous References in virtually every code behind file pertaining to a WPF form. None of the approaches mentioned above will remove these errors. The .Net 7 version of the project remains clean.
thank you for the update.
Is there any chance you could provide us some sample solution in which the problem is reproduced? You can send it using our "Submit a request" form at the top of the page.
Thank you.