I am trying to load javascript in my app using ChakraBridge and I followed the steps given in the following block
Using JavaScript Framework in UWP
and also on GitHub JsBridge
I added ChakraBridge.winmd as reference in my project and it works perfectly fine when debug mode is Script. When I change it to Managed Only, it gives me exception and same for Release mode.
Can someone suggest what is the issue?
Here is the example. I am trying to assign default date in DatePicker in my project using ChakraBridge API
if (!string.IsNullOrEmpty(javascriptFunction))
{
try
{
ChakraHost dateHost = new ChakraHost();
string dateValue = dateHost.RunScript(javascriptFunction);
var finalDate = DateTime.ParseExact(dateValue, "dd-MM-yyyy", CultureInfo.InvariantCulture);
datePicker.Date = finalDate.Date;
}
catch(Exception ex)
{
Debug.WriteLine(ex.Message);
}
}
The javascript function is
function executeScript(){var now = new Date(new Date().getTime() - (7*24*60*60*1000)); return ('0'+now.getDate()).substr(-2)+'-'+('0'+(now.getMonth()+1)).substr(-2)+'-'+now.getFullYear();} executeScript();
StackTrace I get
at ChakraBridge.ChakraHost..ctor()
at MCS.MCSDynamicViewBuilder.<GenerateDynamicControlforMobile>d__10.MoveNext()
Also, it works fine when I debug in my laptop machine and When I debug in mobile or in Mobile Emulator, it gives me this exception. Is it due to dist folder available on my laptop machine from where I refrence ChakraBridge.winmd
?