Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ambiguous references with the exact same namespace

The RC class is not linked to a database, it is a simple class. The class is at only one place and is not partial. The Aérochem.Domain dll project compiles just fine.

Note: If I select one of the two identical namespaces in the quick fix menu, it does nothing.

Note2: This happens to a couple of classes (some related to a database, some not)

Is there a fix to that or a way to figure what's wrong?

enter image description here

like image 691
Mathieu Avatar asked Aug 16 '12 14:08

Mathieu


People also ask

What is ambiguous reference?

An ambiguous reference is the situation in which a sentence contains a pronoun that could refer to either of two nouns in the same sentence or (using our new vocabulary word) where we have a pronoun but we aren't sure what its antecedent is.

What is a namespace in c#?

The namespace keyword is used to declare a scope that contains a set of related objects. You can use a namespace to organize code elements and to create globally unique types. C# Copy.

What is ambiguous error in C#?

ambiguity error is that you named field and property tha same name "colour". change the property definition f.e. public string Colour { get { return colour;} set { colour = value;} }

Why does <name> is ambiguous in the namespace'<namespacename>'?

'<name>' is ambiguous in the namespace '<namespacename>'. You have provided a name that is ambiguous and therefore conflicts with another name. The Visual Basic compiler does not have any conflict resolution rules; you must disambiguate names yourself. To correct this error. Fully qualify the name.

Why does <name> conflict with <namespacename>?

'<name>' is ambiguous in the namespace '<namespacename>'. You have provided a name that is ambiguous and therefore conflicts with another name. The Visual Basic compiler does not have any conflict resolution rules; you must disambiguate names yourself.

Why is'for each'on type'<typename> ambiguous?

'For Each' on type '<typename>' is ambiguous because the type implements multiple instantiations of 'System. Collections. Generic. IEnumerable (Of T)'

Why do some classes have two different namespaces in Java?

It was because someone had put a class in a namespace with different capitalisation to all the other instances of that namespace, so they were effectively two different namespaces.


2 Answers

I had the same problem. I use ReSharper. The solution to my problem was not cleaning the solution but deleting the suo-file. Hope that helps.

like image 195
Michael Mairegger Avatar answered Oct 02 '22 13:10

Michael Mairegger


As for the reference of any future users: This thread covers four answers whereas two are in the comments. I have faced the issue several times, three of these answers have helped me in the past, so if you face the same issue, try any of these:

  • Clean and/or Rebuild the Solution then reanalyze the files in Resharper.
  • Restart Visual Studio then reanalyze
  • Delete the bin/ folder then reanalyze
  • (Apparently deleting the suo-file can help, too, although I never had to do that and can't understand how it should help)
  • A combination of the three above.

(This is not really a new answer, it is more of a comment on the variety of answers and comments found - it is a community wiki so feel free to adapt it if necessary)

like image 41
2 revs Avatar answered Oct 02 '22 13:10

2 revs