4.9.5 --> 5.2.4 : AMBIGUOUS in the namespace Errors?

Hello programming hivemind!

I took a big step this morning. I migrated a project I’ve been working on from 4.9.5 to a newer 5.2.4 build of MapWinGis. I knew this would give me access to more GDAL tools, but I also know this would break certain parts of my code. What I wasn’t prepared for was just how many errors there would be.

It appears that the majority of these errors are ambiguous namespace errors. I have never encountered these types of errors before. I am guessing something has changed with the new build, just different enough, that the existing calls to define new images, extents and the like are broken.

I am writing in VB.net. Can anyone point me in the right direction??

(Example of Errors)

|—|—|—|—|—|—|—|
|Error|BC30560|‘tkCursor’ is ambiguous in the namespace ‘MapWinGIS’.|SitePadaug22|C:\Users\ericp\source\repos\SitePadaug22\Form1.vb|392|
AxMap1.MapCursor = MapWinGIS.tkCursor.crsrCross

|Error|BC30560|‘Image’ is ambiguous in the namespace ‘MapWinGIS’.|SitePadaug22|C:\Users\ericp\source\repos\SitePadaug22\Form1.vb|397|
Dim ProjectChart As New MapWinGIS.Image

Hi,

It seems strange to me that you have an ambiguous reference when you are using the full name - e.g. MapWinGIS.tkCursor… so… do you have multiple references in your project to different MapWinGIS.ocx or Interop.AxMap.dll ?

Regards,

Rob H

It is a very weird error. I have never had an ambiguous reference before, so it’s not something I have had to work through. I Do not believe I have multiple references to the OCX file or to the interop DLL.

When I look under the project references tab in my solution explorer, I see the AxInterop.mapWinGIS and Interop.MapWinGIS DLLs. The reference path both lead back to the C:\dev\MapWinGIS\Interop.MapWinGIS.dll path. In case I am missing something, where do I check for the OCX reference?

When I reinstalled the 4.9 build, the project errors went away and I Could compile/run it as always.

There are about 60 errors that populate when I had the newer 5.2.4 installed, and they were all that ambiguous reference. Am I simply not adding/referencing the API correctly.

I am using visual studio 2019, and I’m a dirty VB.NET programmer. I appreciate any insight.

Could you maybe post a screenshot of the top of the file you previously screenshotted?

Here is a screenshot of the Import statements. and some of the variables. As a side note, line 54 threw the same error. anything Image, Extents and/or TKcursor, etc… threw that ambiguous error code.

Ill screen shot anything you think you need to see. just let me know.

Thanks for that - didn’t see anything obvious. The fact that you are spelling out MapWinGIS.Image for example should mean that it isn’t getting mixed up with System.Drawing.Image for example, so it’s a bit strange. Annoyingly I feel like I’ve seen this before, but I can’t remember what it is.

If you don’t mind sending through a screenshot of the references, that might help.

Here are some screen grabs of the references. I want to believe everything is correct, but I just don’t know as I am new to visual studio and to this API.

As a second avenue to go down, where should the DLLs be located within the project file itself. Like when I manually navigate to the source->repos->sitepad directory I can see that there is a copy of the interop.mapwingis.dll in the (repos\sitepad\obj\debug) folder. just that one DLL, not any others associated with mapwingis. Also, if I navigate to the (repos\sitepad\bin\debug) folder there are copies of the AxInterop.mapwingis.dll and the Interop.mapwingis.dll. So a follow up question is this: if the software is trying to reference the DLL from the DEV folder where mapwingis installs, why would/should there be other instances of the DLL saved within the project files itself?

also you mentioned a reference to mapwingis.ocx…Should there be a reference to that particular OCX file, and where would THAT be located? I guess I thought that was happening in the background by adding the control to the form.

Thanks for that - the thing that stands out to me is that you are referencing the 4.9 version of the .ocx according to what you’ve shown - not 5.2.

I also replicated your setup with 5.2 (and note the version shows 5.2 in the properties window) and it worked for me.

When you installed 5.2, did you add the new version to the “Choose toolbox items” COM tab?

yes, I reverted back to the 4.9 version after encountering the above listed issues. I reverted so that I could at least get back to where I started.

I did not add the 5.2 version to the “choose toolbox items” com tab. If I do that, will I have to add a new com object to have the new version utilized? As this is a pretty extensive project, I would hate to have to start over just to upgrade to the newer 5.2 version.

can you check you project folders to see if you have the DLL files located where I seem to have them. I am wondering if that could be part of the problem as well. thanks so much for your help.

I’m not sure I understood why you think you might have to start over, but I’ve upgraded several times, never needed to start over.

Regarding having the two .dll files in your debug folder - this is totally normal. If you look at the properties of them in your project you’ll see it says, “CopyLocal=true” and so they are copied to the debug folder. This is how I have my setup. These are the wrappers for the COM/ActiveX objects.

(The other option with COM is to set the isolated property to true, but I’ve had problems with that and MapWinGIS)

When you installed 5.2, did you add the new version to the “Choose toolbox items” COM tab?

Yes, but it’s probably not an issue

I take it you have 4.9 and 5.2 both installed on your machine? Have you registered the 5.2 .ocx before building?

I installed the 5.2 package, does that not register the OCX automatically. also, I just reinstalled the 5.2.4 build and when I check the dev folder, the interop.mapwingis.dll and axinterop.mapwingis.dll are both showing as 4.9.0… that cant be right.

I deleted the 5.2.4 files before I reinstalled the 4.9.5 build.

So here is what I think I am going to try, please just give me a sanity check here.

-I am going to download the 5.3 stable build for 32 bit.
-I am not going to touch the files in the Dev folder, i am just going to install the new 5.3 build
-I will then open up the project I am working on and update the reference to the AxInterop and Interop DLLs. I will also update the toolbar COM reference to the new OCX.
Will I need to manually register the OCX?

I can’t remember if the installer uninstalls the old version first, but if not, I’d probably do an uninstall of 4.9 then an install of 5.3.

I always manually register the .ocx, don’t think the install does it, but best to anyway to be on the safe side.

alright, so i uninstalled all versions of mapwingis. I just installed 5.2.4 and manually registered the OCX file successfully. BUT, i do not see the axInterop.MapWinGIS.DLL or the InteropMapWinGIS.DLL files in the Dev\mapwinGIS file…were they moved? is there something wrong with my installation? when you install the 5.2.4 version, do you see those DLLs in the DEV folder?

ironically, the work around I figured out is ending up being way easier than doing it the easy way and upgrading to 5.2.4…

I am doing this upgrade so I can use the rasterTranslate and Warp GDAL functions. My work around is to generate a batch file with the correct commands and to run the functions in a command window accessing osgeo4w PowerShell. This seems to be working, but it requires a generation subroutine, and downloading qgis on all of the machines i want this software to run on. not the end of the world, but clearly not a clean solution.

alright, so i uninstalled all versions of mapwingis. I just installed 5.2.4 and manually registered the OCX file successfully. BUT, i do not see the axInterop.MapWinGIS.DLL or the InteropMapWinGIS.DLL files in the Dev\mapwinGIS file…were they moved? is there something wrong with my installation? when you install the 5.2.4 version, do you see those DLLs in the DEV folder?

I definitely remember they have been left out of the install before, but you can generate them yourself:

Simple way would be to create a new WinForms project, drop a MapWinGIS map on it from the toolbox. For the properties of MapWinGIS reference you want to set “Embed Interop Types” to false. Build and you should have both files.

(You can also use tlbimp.exe to generate these files)

If you can’t get this to work I can send them to you, but it should work just fine.