c# - Windows phone application crash when searching for location -


i've got following function:

private async void searchlocation(string location)     {         var myposition = await new geolocator().getgeopositionasync(timespan.fromminutes(1), timespan.fromseconds(10));         // define search         var geoquery = new geocodequery();         geoquery.searchterm = location;         geoquery.geocoordinate = new geocoordinate(myposition.coordinate.latitude, myposition.coordinate.longitude);         geoquery.querycompleted += (s, f) =>         {             if (f.error == null && f.result.count > 0)             {                 map.center = f.result[0].geocoordinate;                 map.zoomlevel = 12;             }         };          geoquery.queryasync();     } 

it's searching location , show on map. works fine, when i'm clicking on map, application crashes (map_tap empty).
in output appears:

a first chance exception of type 'system.invalidoperationexception' occurred in system.windows.ni.dll

stack trace:

>   notifier.dll!gpsnotifier.app.application_unhandledexception(object sender, system.windows.applicationunhandledexceptioneventargs e) line 112    c# system.windows.ni.dll!ms.internal.error.callapplicationuehandler(system.exception e)    unknown system.windows.ni.dll!ms.internal.error.isnonrecoverableuserexception(system.exception ex, out uint xresultvalue)   unknown system.windows.ni.dll!ms.internal.jolthelper.fireevent(system.intptr unmanagedobj, system.intptr unmanagedobjargs, int argstypeindex, int actualargstypeindex, string eventname)    unknown 

i don't understand anything. exceptions in visual studio hard analyze, because don't show error occured. what's wrong function? i'm executing in button using searchlocation("warsaw");

edit:
before searchlocatio i'm calling function:

private async void showmylocationonthemap()     {         geolocator mygeolocator = new geolocator();         geoposition mygeoposition = await mygeolocator.getgeopositionasync();         geocoordinate mygeocoordinate = mygeoposition.coordinate;         geocoordinate mygeocoordinate =             coordinateconverter.convertgeocoordinate(mygeocoordinate);         this.map.center = mygeocoordinate;         this.map.zoomlevel = 15;         currentlocation.coordinates = mygeocoordinate;                  } 


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -