Problems w/ MapScript C#

Johannes Schulte Sÿfffffcdhoff johannes_schulte_sudhoff at YAHOO.SE
Thu Apr 7 05:30:41 EDT 2005


--- Sean Gillies <sgillies at FRII.COM> wrote:
> On Apr 6, 2005, at 3:59 PM, Morten Nielsen wrote:
>
> >> 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
> >
>
> My impression is that you may be getting ahead of
> yourselves a bit with
> your SimpleMap and Form classes.  Let's back up a
> bit.  Make the
> simplest possible mapscript application, and then
> run the web app under
> your debugger to find out what the problem actually
> is.  If you can't
> debug your website, perhaps try with some sort of
> lightweight
> multithreading HTTP server.  The .NET platform must
> have something like
> this.
>
> That said, now I am going to take a wild swing :)
> Any chance that
> you've overlooked building in the win32 thread
> support from
> mapthread.c?  It's off by default in MapServer's
> windows makefile and
> never really mentioned in any of the win32
> installation docs.

Just another wild swing :-). Morten is using the
windows binary of the gd library. Doing this you have
to compile everything with VC6 and you have to bind
the multithreaded dll crt. see the gd faq for more
information

/Johannes



More information about the mapserver-users mailing list