Works when compiled with VS2013 but NOT WITH VS2015
Posted: Tue Mar 22, 2016 11:18 am
It took me forever to find out why my code worked when I wrote my test app (at home under VS2013) but did not work when compiled at the office (under VS2015).
The code below works fine when compiled with VS2013 but when compiled with VS2015 gives the following error...
Uncaught Error: Type 'System.Runtime.CompilerServices.CallSite`1' has not been defined.
The code below works fine when compiled with VS2013 but when compiled with VS2015 gives the following error...
Uncaught Error: Type 'System.Runtime.CompilerServices.CallSite`1' has not been defined.
Code: Select all
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Shapes;
using Windows.UI.Xaml.Media;
namespace HTML5_Test
{
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
private void gpsButton_Click(object sender, RoutedEventArgs e)
{
GetLocation();
}
void GetLocation()
{
gMainPage = this;
CSHTML5.Interop.ExecuteJavaScript( @"navigator.geolocation.getCurrentPosition($0);", (Action<dynamic>)GpsReceived);
}
static MainPage gMainPage = null;
static void GpsReceived(dynamic position)
{
double glat = 0;
double glon = 0;
glat = (double)position.coords.latitude;
glon = (double)position.coords.longitude;
gMainPage.ShowLatLon(glat, glon);
}
public void ShowLatLon(double glat, double glon)
{
cLatitude.Text = "Lat: " + glat.ToString();
cLongitude.Text = "Lon: " + glon.ToString();
}
}
}