Problems w/ MapScript C#

Morten Nielsen morten at DOTNETGIS.NET
Wed Apr 6 17:59:30 EDT 2005


>I've successfully built the C# Mapscript assembly, and have successfully
>written code that generates an image file to disk.  Everything seems to
>work just fine until I make repeated calls to the map.draw() function.
>I get the following exception after 3 or 4 calls to the private member
>function drawMapImage():

>System.NullReferenceException: Object reference not set to an instance
>of an object.
>   at mapscriptPINVOKE.mapObj_draw(IntPtr jarg1)
>   at mapObj.draw()
>   at SimpleMap.Form1.drawMapImage()

I have lately experienced the same problem that Ian has. It seems that the
C#/SWIG mapscript is very unstable, no matter whether it's a Windows
Application or a web application. Some times it works, sometimes it don't.
Sometimes it always works on one machine, but never on another. And
sometimes it even crashes the IIS process. I wonder if this also occurs on
the Mono-based assemblies.

The C# support in SWIG is pretty new, so it could be a SWIG bug, but I
wasn't ably to find any that apply in their bug-tracking. Perhaps we should
better start looking at the SWIG implementation, although I really wouldn't
know where to begin; especially because it's so hard to debug.

Pointers to get me started on this are highly appreciated.

/Morten Nielsen



More information about the mapserver-users mailing list