Weekly Wednesday Tech Talk – Theme1: Xamarin.Forms

Theme for the first meeting (april 8th): Xamarin.Forms

Our software lunch chat will start with a Xamarin discussion – possibly (and very likely) touching on issues like comparison with Flutter and React Native – but leaving the big discussion about that for later.  The focus of the meeting is developers in Iceland – we will choose the language based on attendance, but no Danish please 🙂

This is a technical meeting – so we’ll expect diving into code and sharing screens where applicable.

Zoom link: https://zoom.us/meeting/918675917

FontAwesome .otf not working in Xamarin IOS

Had a problem of icons always displaying properly in preview but only showing up as boxes in the IOS emulators.   Went through all the usual manuals but the following 2 things were not often mentioned.

  1. Make sure to include “Fonts provided by application” key in Info.plist with the array of full font FILE NAMES included in the resource folder, e.g. “FontAwesome5Solid.otf
  2. Set the build action of the .otf files to Content and “Always copy”

MT2001 could not link assemblies – Xamarin IOs

Had this build error – preventing all IOS development. Searched around for fixes all over the place but of course the solution was simple as usual 🙂    I had accidentally added a direct Mono.dll dependency in my base project and was referencing the Android namespace (using Android.***) in a couple of (XML and c#) files. This caused the MT2001 horror 🙂  Again, learned a lot about the build procedure during the debugging process but the solution was just toooo simple as usual. Hope this helps someone.

Facebook OWIN login not working – returning null from AuthenticationManager.AuthenticateAsync

Using OWIN 4.0.1 on my sites – the google authentication worked fine but I couldn’t find out why the Facebook process always returned null – redirecting only to the same URL – adding the typical #_=_ to the /Account url.    Finally thought of my Cloudeflare proxy and that it might be impacting Facebook’s response.  Turning off the cache solved the issue – but maaaaan how much I have learned in the past 10+ hours spent on this 😉  #liveandlearn

Xamarin.Forms: Error parsing XML: not well-formed (invalid token) when compiling Android

Suddenly my Android Xamarin.Forms project stopped compiling because of a couple of corrupt XML files. The error message is: “Error parsing XML: not well-formed (invalid token)”

Turns out that at that the source resource files in the

C:\Users\Geir\AppData\Local\Xamarin\Xamarin.Android.Support.v7.AppCompat\23.3.0.0\embedded\res\

folder had been corrupted, probably by my antivirus program, there was a path to Avira among the unreadable (I have no clue what kind of encoding or content was in the file – it was not XML)

This file is on compile time copied into the  \obj\Debug\resourcecache\[some-identifier]\res\ folder where it is of course unparsable as XML.

Hope this helps someone, took me a while to figure out from where the xml file was copied (of course file search should have come to my mind an hour earlier than it did 🙂 )

Capture

Visual Studio 2017 – .net 4.5.2 – The compiler failed with error code 255.

This gave me the reason to start blogging again – just with the hope that a single developer might get some extra moments doing fun coding instead of analysing this horrible error …. it took me some useless IIS and permission experimenting before stumbling upon this solutijon.

http://stackoverflow.com/questions/32282880/publish-website-without-roslyn

“When you create a new web project, two nuget packages automatically added to your project. If you remove them, your problem should be solved. Package names are: “Microsoft.CodeDom.Providers.DotNetCompilerPlatform” and “Microsoft.Net.Compilers”.

JQuery ajax ($.ajax()) returning to error function despite success (200 ok) response

Turns out that returning void from (asp.net mvc) server function, but jquery ajax call data type was set to json – so when receiving no data back – the ajax function returns to the error function.

So the example below would always alert “error” as the server controller action return was void

$.ajax({type: “POST”,url: “/MyController/MyAction/”,data: [postData], success: function (data) { alert(“success”); }, error: function () { alert(“error”); } });

Java Play framework: Driver not found: [com.mysql.jdbc.Driver]

Dealing with the Java Play framework for the first time – I followed the instructions here:

http://www.playframework.com/documentation/2.0/ScalaDatabase  (and in a number of other Stackoverflow posts and various blogs)  

All failed to mention (or I somehow failed to read) that one has to “reload” the solution in the console after adding the database reference for the application to load the jdbc driver into the application.  Probably too obvious for regular users – but too a couple of hours for a newbe like me to figure out 🙂