Tuesday, March 15, 2016

Initial Learnings Setting Up For Xamarin

I've been gearing up some work projects as well as some home projects recently to use Xamarin.  Specifically, of special interest to me is Xamarin Forms. In my opinion this is a truly incredibly useful technology.

But first, inevitably, there is some setup and familiarisation to get through before getting into code.  Here are some of my random findings during this process.

The Xamarin trial period is too short.

Its fantastic there actually is a trial period. However there's quite a bit of learning and discovery to do, and 30 days is just not enough.  Its an amazing product well worth the money, so don't be afraid to jump in.  The Xamarin.com web site pricing indicates pricing per month, but you must sign up for a full year however.

The Android SDK Emulator is still shocking.

Glaciers move faster than the default Android SDK Emulator.  There is wide recognition of this, but in the few years I've been involved in mobile development, it hasn't really improved.  The number of how-to web pages describing performance tweaks seems to back this up as well.

TIP: Fortunately there is a decent Andriod Simulator now for Visual Studio.  It can be downloaded and installed separately here.
The good news: It even integrates into Visual Studio Community edition and Xamarin Studio.  The bad news: It doesn't work with operating systems that don't support Hyper-V (which include Windows 10 Home see here).

TIP: Don't close the Emulator when you're finished debugging, running code again with Visual Studio or Xamarin Studio will redeploy and reattach much faster than re-opening it.

Creating New Projects in Xamarin Studio.

Xamarin Studio doesn't set all the same defaults as Visual Studio.  

TIP: I had to manually tick the box to deploy my application when I 'F5' or click the Debug button. The Deploy box needs to be ticked.

TIP: Using File-New-Project in Xamarin Studio doesn't create any Windows flavoured Apps. Also if the Apple build server isn't available at the time, you won't get an iOS App project either.  I've had some trouble using Visual Studio File-New-Project with creation errors and PowerShell errors (which is probably issues with my rig rather than Vs), but Xamarin Studio has worked every time.

Visual Studio vs Xamarin Studio on Windows

I've been impressed with Xamarin Studio so far.  If you're a fan of Visual Studio like me, don't be tempted to write it off.  Xamarin Studio presents a very clean and simple IDE with full intelli-sense support.  I couldn't fault it creating new prototype Apps and debugging worked seemlessly everytime. It even can deploy and debug code to the new Visual Studio Android Emulator. 

On the downside, Xamarin Studio does not have a XAML designer at all, which is a real negative for me.  Another obvious issue is that any iOS Xamarin native development can only be performed on Xamarin Studio on a Mac.  (Any shared iOS/Android PCL development can be done on Windows however). Also, only a Mac can build the native iOS binaries.  Both Xamarin Studio and Visual Studio can use a Mac remotely on the LAN to trigger a build.  The iOS Simulator can only be used locally on a Mac however.

I don'y miss R# that much its stops me from using Xamarin Studio, but any kind of XAML editing I prefer Visual Studio. Anecdotally, I do believe Xamarin Studio performs better than Visual Studio.

Resharper tends to show phantom errors

Not sure what's going on with R#, but with my version, 10.0.2 I occasionally see red squiggly underlines indicating errors on methods that are building and functioning fine. No solution for this so far, but its not a show-stopper for me.

TIP: When building for the first time in Visual Studio, I had some phantom errors showing up which are coming from R#.  To get rid of them I changed the build error filter to "Errors Only"; it was defaulting to "Errors+Intellisense".

Thats all I have for now, more learning still to do, so I'll have more to say in the near future.