4

A client of ours reported that when trying to use our .NET .DLL in VB.NET they receive the error:

error BC31429: 'OurClass' is ambiguous because multiple kinds of members with this name exist in namespace 'our.company.nspace'

I've also been able to reproduce the error with a dummy project containing the single line of

Dim x as our.company.nspace.OurClass

Normally this is because there are several types with names differing only in case. But in this case there is no such ambiguity. OurClass is a unique name not only in the specific namespace but in the whole assembly and any other assemblies referenced by the project. Reflector also shows this. There are also no class members with the same name, also verified by Reflector.

Also a weird thing is that the error wasn't there immediately after I created the dummy project, and then it suddenly appeared and now it doens't go away anymore. In fact I didn't even change anything between the two recompiles from which the first one worked, and the second didn't.

So... what gives?

(Note: the .DLL uses and references vjslib (J#), if that is of any relevance)

Vilx-
  • 104,512
  • 87
  • 279
  • 422

3 Answers3

1

Have you tried using the Global. prefix? e.g.

Dim x as Global.our.company.nspace.OurClass

See http://msdn.microsoft.com/en-us/library/k701czy1(VS.90).aspx

Quango
  • 12,338
  • 6
  • 48
  • 83
1

Found the issue. There are two classes with duplicate names one lowercase (marked as "obsolete") and one uppercase but both left in the code. Not CLS compliant obviously and blows up VB.Net which is not case sensitive.

generate and Generate

generateAsync and GenerateAsync

Solution for today is to download from GitHub, remove the lowercase offenders, recompile and manually add to project at least until an updated fix is posted on their end.

brianc
  • 455
  • 2
  • 21
  • That's great, but in my question I had already ruled out that possibility. Anyway, this was more than 7 years ago. :) – Vilx- Nov 10 '17 at 08:03
0

I've had this issue when deploying a web app before. I wasn't getting the error in my development environment, but when I tried to deploy it to a test server I got the ambiguous namespace error. I had to delete all of the DLLs from the bin folder and then redeploy the application.

It sounds like it could be a reference issue. Perhaps the client just needs to remove and re-add the reference to your DLL and then do a Rebuild on their solution?

Fake
  • 498
  • 4
  • 11
  • Read the question carefully. I was able to reproduce the situation, and it was a windows app, and had nothing to do with references. – Vilx- Nov 05 '10 at 08:06