[SOLVED] Geolocation - Object reference not set to an instance of an object


Hi, i’m curently working on a web based app using the geolocation extension, written in vb net, having downloaded the example project to know how to use it i replicated the same snippet of code in the new project, but i have a strange error:

Object reference not set to an instance of an object

the code i’m currently using is the following:

Dim Position = Await Wisej.Ext.Geolocation.Geolocation.GetCurrentPositionAsync()
lbl_lat.Text = Position.Latitude.ToString()
lbl_long.Text = Position.Longitude.ToString()

You can see the full snippet as a pic down below, but although i recreated and translated it in vb net from c#,either alone or with online converter, the code tell me that, what i do to resolve it?

Thanks in advance

  • You must to post comments
Best Answer

Try creating an instance and calling async on it:

Dim g As Wisej.Ext.Geolocation.Geolocation
 Dim Position = Await g.GetCurrentPositionAsync()

Hope that helps.

Best regards


  • You must to post comments

Hi, the code works, thanks, but i have anothers questions.
To test the geolocation i must use a https server only? Or i can test it in localhost on my machine?
And how i put the timeout on the function to make it quicker?


  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.