ShapeFinder2 Error Whilst Loading Classifier/Model

Hi All,

Hope you are well.

I’m running into an error whilst trying to load a ShapeFinder2 model into the new .NET API, see below;

Can anyone point me in the right direction of what I’m doing wrong.

Thanks,
Josh

That’s unexpected!

The message indicates an access violation in unmanaged code while loading. Is there any chance you could share that classifier file so I could investigate?

Hi Illusive,

Sure…model is within the zip file.

SFModel.zip (102.2 KB)

The model was created with a tutorial using the old .NET API, not sure if this would have anything do with it? I assumed the model structure was the same between the two API’s?

Thanks for your support.

Thanks, I’ll have a look asap and come back to you. The API is unlikely to be the issue - both, the old .Net API (the simple C-style wrappers) as well as the object-oriented CVB.Net API rely on the unmanaged SF.dll to load and save classifiers.

Ok, I think we’ll need to talk about versions… I can load the classifier just fine with code written in C# as well as C++ and its properties look consistent - so the file should be ok. Can you tell me the version numbers of

  • your installed Common Vision Blox
  • the file SF.dll in the %CVB% directory
  • the file Stemmer.Cvb.ShapeFinder.dll in the %CVB%\Lib\Net directory (I assume that this is the file that your project depends on; in case you depend on a copy in a different location please let me know the version number of that copy

What might also be helpful (but is sometimes a little bit difficult to transmit for size reasons) is a crash dump. If you can produce one and share it with me through a Dropbox-like service please PM me the link (don’t post on the forum).

Just to be sure: If you open the classifier in %CVB%\Tutorial\ShapeFinder\VB.NET\SF2TeachNET\bin\SF2TeachNET.exe it works?

Sure,

CVB Version: 13.02.004
SF.dll Version: 13.2.0.0
ShapeFinder.dll: 14.0.0.0

The model will open inside the VB tutorial (no error).

Ill PM you the crash dump.

Thanks.

Sorry illusive,

How am i private messaging you? Can’t seem to find a link :thinking:

Please click my avatar icon. The box that opens up should have a “Message” button in the top right corner:
image

Capture

I don’t seem to have the option

Weird! I’ll have to look into that - probably a rights thing.

I think I managed to fix the problem you highlighted. First of all: In principle it is present in x64 as well as in win32 execution - but for whatever reason it’ll only lead to an access violation when running as a 32 bit application, but not when running as a 64 bit application - which is why I initially did not see it (I was running x64).

What happens is that for the retrieval of the feature lists internally an array is created and then filled by the CVCImg.dll with the points that are in the feature list of the classifier. However, this array was created one element too small, which led to a write access beyond the allocated array boundaries (and the .Net runtime then catches up on that and raises an error).

I have prepared new builds of the Stemmer.Cvb.ShapeFinder.dll for CVB 13.3 (Stemmer.Cvb.ShapeFinder.dll CVB 13.3.x.zip (25.4 KB)) as well as CVB 13.2 (Stemmer.Cvb.ShapeFinder.dll CVB 13.2.x.zip (25.4 KB)). To use the patch, copy the file to the %CVB%\Lib\Net folder (a file with the same name already exists…) and install it in the global assembly cache (open a Visual Studio command prompt with admin privileges, then execute gacutil -i Stemmer.Cvb.ShapeFinder.dll inside the %CVB%\Lib\Net folder).

Once we make new installers (that would be 13.02.006 or 13.03.002) these changes will be part of the standard installation of :cvb:

Thank you very much for pointing this out and thanks for your patience.

2 Likes

it was a rights thing… now you should see a “Message” button :slight_smile:

Ill give that a go now and let you know how it goes!

Thanks again for your support.

I do now. Thanks :slight_smile:

Thanks illusive, the fix is working well. :+1:

2 Likes