System Error: Failed invoking symbol App crash

Hello, 

I´ve got the: 

Error: System Error
Details: Failed invoking <symbol>
Stack:
- messageReceived() at C:\Users\smiea\eclipse-workspace\tst\source

avApp.mc:84 0x100008a2

Can´t really understand or I´m completely blind and don´t see the cause, why my app crashes on entering for loop. Has anyone bumped into this aswell?

SDK version 3.2.x, Vívoactive 4S

This is whole function, which is called when I got message from phone with data, that needs to be parsed.

function messageReceived(message){
		if(message.data["type"].toString().equals("routeSteps")){
			try{
				routeSteps = parseRouteSteps(message);
				//Storage.setValue("routeSteps", routeSteps);
				System.println("routeSteps parsed");
			}
			catch(ex){
				System.println(ex.getErrorMessage());
			}	
		}
		if(message.data["type"].toString().equals("routePoints")){
			try{
				routePoints = parseWayPoints(message);
				//Storage.setValue("routePoints", routePoints);
				System.println("routePoints parsed");
			}
			catch(ex){
				System.println(ex.getErrorMessage());
			}
		}
        if(message.data["type"].toString().equals("boundingBox")){
			
			boundingBox = new [2];
            boundingBox[0] = new Position.Location({
												 :latitude => message.data["data"][1],
        										 :longitude => message.data["data"][0],
        										 :format => :degrees});
            boundingBox[1] = new Position.Location({
												 :latitude => message.data["data"][3],
        										 :longitude => message.data["data"][2],
        										 :format => :degrees});
            latLongToPixels = new [routePoints.size()];
            
            
            topLeft = new MyReferencePoint(26, 36, boundingBox[1].toDegrees()[0],  boundingBox[1].toDegrees()[1]);
            bottomRight = new MyReferencePoint(191, 181, boundingBox[0].toDegrees()[0],  boundingBox[0].toDegrees()[1]);
            topLeft.setGlobalXY(latlngToGlobalXY(topLeft.latitude, topLeft.longitude, topLeft, bottomRight));
            bottomRight.setGlobalXY(latlngToGlobalXY(bottomRight.latitude, bottomRight.longitude, topLeft, bottomRight));
            
            for(var i = 0; i < routePoints.size(); i++){
                System.println("Pozice: " + i + " Lat: " + routePoints[i].toDegrees()[1] + " Lon: " + routePoints[i].toDegrees()[0]);
                latLongToPixels[i] = latlngToScreenXY(routePoints[i].toDegrees()[0], routePoints[i].toDegrees()[1], topLeft, bottomRight);
                System.println("Pozice: " + i + " X: " + latLongToPixels[i][0] + " Y: " + latLongToPixels[i][1]);
            }
            
			//Storage.setValue("latLongToPixels", latLongToPixels);
            System.println("bb ok");
		}
	}

This is the bit of code throwing the error. Checked that, the routePoints array is not null.(always got size with initialized Location values). 

for(var i = 0; i < routePoints.size(); i++){ //line 84 in my code
    latLongToPixels[i] = latlngToScreenXY(routePoints[i].toDegrees()[0], routePoints[i].toDegrees()[1], topLeft, bottomRight);
}

  • Kinda solved my own issue, so I´m posting solution for anybody that stumbles across this problem aswell.

    Tried to rewrite code to use while loop, declared variable outside of the start of for loop - no success. Solution was to put the loop into function and call that function.

    Code looks like this:

        .
        .
        .
        topLeft = new MyReferencePoint(26, 36, boundingBox[1].toDegrees()[0],  boundingBox[1].toDegrees()[1]);
        bottomRight = new MyReferencePoint(191, 181, boundingBox[0].toDegrees()[0],  boundingBox[0].toDegrees()[1]);
        topLeft.setGlobalXY(latlngToGlobalXY(topLeft.latitude, topLeft.longitude, topLeft, bottomRight));
        bottomRight.setGlobalXY(latlngToGlobalXY(bottomRight.latitude, bottomRight.longitude, topLeft, bottomRight));
        
        parse(routePoints, topLeft, bottomRight, latLongToPixels, latLongToPixels.size());
    }
    	
    	function parse(routePoints, topLeft, bottomRight, latLongToPixels, size){
    	    for(var i = 0; i < size; i++){
                latLongToPixels[i] = latlngToScreenXY(routePoints[i].toDegrees()[0], routePoints[i].toDegrees()[1], topLeft, bottomRight);
            }
    	}

  • Faced same problem. My code was working, then I made some changes and it started to fail on entering a loop (corresponds line #1 in code below) . Once I remove the loop it's all fine. If I replace my loop with a very simple one (see below) - it fails again.

    If I move this loop few lines above then it works again. If I start modify the code (not the lop itself) it starts to fail again.

    Error: System Error
    Details: Failed invoking <symbol>
    Stack:...

    for(var k = 1; k < 10; k++) {
    	System.println(k);
    }

  • Fixed by installing latest SDK and move from eclipse to vsstudio.