Xamarin Forms app fails to deploy in Windows Phone with "System.TypeLoadException" - windows-phone-8.1

My Xamarin Forms app runs successfully in Android but fails to run in Windows Phone 8.1. It shows -
An exception of type "'System.TypeLoadException' occurred in MyAppName.DLL but was not handled in user code" in the InitializeComponent() method .
Note: This is a Prism MVVM App and the 'App' class inherits from 'PrismApplication'.

I'm not sure if it's the real reason, but there was a Page named MainPage.xaml both in my PCL project and WindowsPhone 8.1 project. I was using the page in PCL project and after renaming it, the app worked :)

Related

How to use third party dll in windows phone 8.1 application with windows runtime component?

I have created the windows phone 8.1 application in which I want to use third party dll file. That's why I have created windows runtime component for the windows phone project. I have given reference of the runtime component to the windows phone 8.1 application project.
In windows runtime component, I have set the additional Include directory path. Moreover, I have also set the Linker -> Input ->additional dependencies as lib file listing. I have drag drop all dll files in my c# windows phone application main project folder and set build action as content and copy output directory as copy always.
However, I got the following error.
An exception of type 'System.IO.FileNotFoundException' occurred in App1.WindowsPhone.exe but was not handled in user code
I have checkout the following question. But did not resolve it.
How to use a C++ dll in Windows Phone 8.1 XAML App within C++ Runtime Component
I found the answer. All the dependencies has been set properly. There was an issue in the dll file which architecture does not match with the current platform.
After created the build for proper architecture, it works.

Can't use XLabs prerelease packages in appstore builds

I am building an app with Xamarin Forms and XLabs plugins.
To be able to run everything smoothly on Android and Windows Phone, i've had to use a prerelease version of xlabs (2.2.0-pre05).
When I tried to create a Windows Phone appstore package the certification failed because the packages for 2.2.0-pre05 have been built in debug mode.
To overcome this, I cloned the git hub project for XLabs and built everything in release mode.
The problem is, when I try to build the project with the packages i've built, I get this error:
Payload file '..\packages\Mike Xlabs\XLabs.Platform.WinRT.Phone\FodyWeavers.xml' does not exist.
Also, the windows store certification checks fail because of libraries used by the prerelease package.I'm getting the following error:
Error Found: The supported APIs test detected the following errors:
This API is not supported for this application type - Api=D2D1GetGradientMeshInteriorPointsFromCoonsPatch. Module=d2d1.dll. File=SharpDX.Direct2D1.dll.
Impact if not fixed: Using an API that is not part of the Windows SDK for Windows Phone Store apps violates the Windows Phone Store certification requirements.

onesignal in visual studio 2015

I'm trying to use onesignal in a mobile application for windows phone but i can't reach to make it works.
I created an example App with ionic :
ionic start testAppWithOneSignal blank
I created my App on Windows dev center
On onesignal.com my App is configured for Windows Phone 8.1+
In Visual studio, SDK is installed and appears in references for my App
Package.appxmanifest settings are ok (Toast capable : yes , capabilities : "Internet client & server"
My App is associated with windows store
When i launch my App on a windows phone, it works but when i add this code, my App crash when it goes in :
window.plugins.OneSignal.init("XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
{googleProjectNumber: "XXXXXXXXXXXX"},
function(){console.log('oneSignal OK')});
Here the details of my configuration :
Cordova CLI: 5.3.3
Ionic CLI Version: 1.7.11
Ionic App Lib Version: 0.6.5
Visual studio : Community edition 2015
Windows 10
To get a stack trace of the crash you can try changing the Debugger Type to "Script Only" or "Managed Only" under the properties of the WP8.1 project.
There is also a OneSignal-Ionic-Example project you can try to determine if the crash is from your project or if it is another issue. Make sure you're using the WP8.1 branch of the project.
https://github.com/one-signal/OneSignal-Ionic-Example/tree/WP8.1

WP8.1 Listpicker throws (Error HRESULT E_Fail has been returned from a call to a COM component)

Windows Phone Databound project targeting WP 8.1 OS.
Added WPToolkit through NuGet
Added toolkit reference to the page:
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
Added a list picker and gave it items source.
When I deploy to the phone it is working just fine. But in the designer I get this error, and it's pretty annoying, I was wondering if I can do something about it?
UPDATE:
Restarting visual studio solved the problem.

Cannot find type System.SystemException in module mscorlib.dll when reference to Microsoft.Phone in Windows Phone 8.1 app template

Microsoft just released Windows App 8.1 with combination of Windows 8.1 and Windows Phone 8.1, so you can create a universal app. However, it gives me a trouble to add Microsoft.Phone 8.1 assembly to project reference.
Here is what I did (in Visual Studio 2013, with Rc2 installed)
1> Create New project from Visual C#->Store Apps -> Windows Phone Apps.
2> Added Microsoft.Phone from this location: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\WindowsPhone\v8.1
3> Now, do a build, I see the following Error: "Cannot find type System.SystemException in module mscorilib.dll"
Anyone has the similar experience? any solutions?
Thanks
There has been a few API changes as part of programming model in windows phone 8.1 apps.
have a look at this link.
It will solve your problem.
http://blogs.msdn.com/b/paraswadehra/archive/2014/08/21/how-to-send-email-from-your-windows-phone-8-1-app.aspx