[mapguide-users] mgnullreferenceexception after MgLayer::GetClassDefinition()

mjirku martinjirku at gmail.com
Thu Aug 7 04:11:50 PDT 2014

I am working on Win7, MapGuide OS 2.6 and source is read from MS SQL.
I have strange problem with MgLayer object:
I've created MgMap object using site connection. Then I open the map with
mapName as a parameter and I get the specific layer from the MgMap object.
However outside of scope of the "setLayer" method I am not able to get class
definition for current MgLayer I've already extracted.
When I uncomment following three echo's one by one, I will get these
- *First echo*: outputs the name of the Layer
- *SECOND ECHO*: throws mgnullreferenceexception
- *Third echo* (inside of "setLayer" method): outputs the table name of the
source without problem.

Notice that "SECOND ECHO" and "Third echo" are identical, only difference is
the scope of functions.

I am curious how does it work, why there are such differences and what can I
do different to have access to class definition outside of methods scope.

View this message in context: http://osgeo-org.1560.x6.nabble.com/mgnullreferenceexception-after-MgLayer-GetClassDefinition-tp5155410.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

More information about the mapguide-users mailing list