I am using Visual Studio 17 to create a Cordova windows application which has a uwp plugin.This plugin is refering a Windows Runtime Component(this component output file type is .winmd
).
When I set minimum windows target sdk to 10.16299.0 then I cannot create object of a class which is in the Windows Runtime Component (which is in the winmd file and refering some dll(.net core 2.0)) but when I down grade the minimum windows target sdk to 10.15063.0 or lower then the problem resolves.
The requirement is that I have to use windows sdk v10.16299.0 as the minimum version and v10.17763.0 as max target. Can I do that? PLease help..
This is my cordova plugin's plugin.xml
<?xml version='1.0' encoding='utf-8'?>
<plugin id="cordova-plugin-uwp" version="0.0.1" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>Uwp</name>
<js-module name="Uwp" src="www/Uwp.js">
<clobbers target="cordova.plugins.uwp" />
</js-module>
<platform name="windows">
<js-module name="UwpProxy" src="src/windows/UwpProxy.js">
<merges target="" />
</js-module>
<resource-file src="src/windows/libs/Component.dll" target="Component.dll" device-target="windows" reference="true" />
<resource-file src="src/windows/libs/SmartThreadPool.NetCore.dll" target="SmartThreadPool.NetCore.dll" device-target="windows" reference="true" />
<framework src="src/windows/libs/CCRuntimeComponent.winmd" custom="true" implementation="src/windows/libs/Component.dll"/>
</platform>
</plugin>
In UwpProxy.js I am trying to create an object of the winrt class
this.setUwpWinRT(CCRuntimeComponent.UwpWinRT.instance);//(with 15063 its created but not with 16299)
if (this.getUwpWinRT() != null || this.getUwpWinRT() != undefined) {
if (this.getUwpWinRT().getJsCallback() == null || this.getUwpWinRT().getJsCallback() == undefined)
this.getUwpWinRT().setJsCallback(this.messageCallback.bind(this));
else throw new Error("Unable to set WinRT callback.");
if (options != null || options != undefined) {
this.setUiCallback(options[0].callback);
}
}
}
this is the error that is thrown every time I set the minimum target to v10.16299.0
0x80131040 - JavaScript runtime error: Unknown runtime error occurred
WinRTError: Unknown runtime error
at UwpProxy.prototype.init (ms-appx-web://io.cordova.myapp5447c6/www/plugins/cordova-plugin-uwp/src/windows/UwpProxy.js:55:9)
at startConnection (ms-appx-web://io.cordova.myapp5447c6/www/plugins/cordova-plugin-uwp/src/windows/UwpProxy.js:100:13)
at Anonymous function (ms-appx-web://io.cordova.myapp5447c6/www/plugins/cordova-plugin-uwp/src/windows/UwpProxy.js:107:17)
at notifySuccess (ms-appx-web://io.cordova.myapp5447c6/www/WinJS/js/base.js:2110:21)
at state_success_notify.enter (ms-appx-web://io.cordova.myapp5447c6/www/WinJS/js/base.js:1792:21)
at _run (ms-appx-web://io.cordova.myapp5447c6/www/WinJS/js/base.js:2008:17)
at _completed (ms-appx-web://io.cordova.myapp5447c6/www/WinJS/js/base.js:1976:13)
UPDATE-----
I have gone through the problem agin and found out that the problem is in the Windows Runtime Component which is not supporting 16299 version of windows sdk. Whenever I have used v15063 I was able to create instances of the Windows Runtime Component in the javascript file but with the v16299 could not even call a static function.
Is there any solution for this particular problem?
User contributions licensed under CC BY-SA 3.0