Search code examples
visual-studio-2015ibm-mobilefirst

MFPF 7.1 - Windows 8.1 Application gives error while run in visual studio


I am using MFPF 7.1 latest fixback. Have installed Visual Studio 2015 and Windows phone and universal SDK and emulator.

Build the environment in eclipse and opened the project in Visual Studio. Build and Deploy is success. but while try ti debug using run, It gives the below error.

enter image description here

As suggested in the alert, disabled the break down option in the settings. But still getting the same error. Getting this error in Angular.js and worklight.js


Solution

  • You should review the following blog post, which talks about possible exception when using frameworks such as AngularJS in Windows applications with MobileFirst Platform Foundation: https://developer.ibm.com/mobilefirstplatform/2015/10/13/javascript-add-dynamic-content-errors-in-mfp-win8-winrt-apps/

    The blog post suggests possible workarounds:

    To avoid or ignore such errors while using the frameworks in your app, Microsoft provides a way to disable the scripts injection validation. It can be disabled by just wrapping the function that injects the content dynamically with MSApp.execUnsafeLocalFunction and in this way your code works without errors.

    Example:

    MSApp.execUnsafeLocalFunction(function() {
        var body = document.getElementsByTagName('body')[0];
        body.innerHTML = '<div style="color:' + textColor + '">example</div>';
    });
    

    More information in the blog post.