Xamarin Forms Gotchas

AppData\Local\Xamarin\Android.Support.v7… doesn’t exist or file corrupted

Delete all files in C:\Users\YOURUSER\AppData\Local\Xamarin\zips

The type or namespace name ‘App’ does not exist in the namespace ‘BeCarefulOfLongNamesApp’ (are you missing an assembly reference?)

Right click your solution > Manage NuGet packages > Updates > Update all Xamarin related packages for each project you have problems.

The “XamlCTask” task failed unexpectedly…

Clean and rebuild the solution after fixing errors or check if your path exceeds the maximum length (260 characters).

Can’t connect to Mac

  1. Enable Remote Login
  2. Install Xamarin Studio
  3. Install XCode and follow these steps



  • Install compiled images
  • Uninstall PostSharp visual studio extension
  • Reboot pc (last hope)
  • Install PostSharp visual studio extension

Tried to compile a project from work at home and got greeted by that message, i have installed the compiled images at work but not at home so i thought that was the problem, but you “can’t” get the prompt to install the images because it only shows when you compile.

Navigate to: C:\ProgramData\PostSharp\YOURVERSION\bin.Release\

And execute your respective postsharp.srv.exe. After that just reboot your pc and install the visual studio extension (if you uninstalled it) and hope for your project to compile.

Drawing a rectangle on monogame

I’ve been trying to get some information about drawing a single rectangle on monogame to no avail, too much information scattered and unfinished examples (and a lot of obfuscated exceptions on code).

First we need the starting position (I used the location where the user pressed and maintains pressed the left click):

_selectionInitialPosition = new Vector2(Mouse.GetState().X, Mouse.GetState().Y); // it’s set just once on left click press
Vector2 mousePosition = Extensions.GetMouseVector2(); // Current position, refreshes in every update call

Now we set the vertex points:

var vertexPositionColors = new[]
 new VertexPositionColor(
 new Vector3(_selectionInitialPosition.X, _selectionInitialPosition.Y, 0), Color.White),
 new VertexPositionColor(new Vector3(_selectionInitialPosition.X, mousePosition.Y, 0), Color.White),
 new VertexPositionColor(new Vector3(mousePosition.X, _selectionInitialPosition.Y, 0), Color.White),
 new VertexPositionColor(new Vector3(mousePosition.X, mousePosition.Y, 0), Color.White)

Then we get the “draw pattern” (From a to b, from b to c, etc):

var lineStripIndices = new short[] {0, 2, 3, 1, 0};

And heres the drawing part:

var basicEffect = new BasicEffect(graphicsDevice) // Used for drawing
 View = Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 1.0f), Vector3.Zero, Vector3.Up), // camera
 Projection = Matrix.CreateOrthographicOffCenter(0, graphicsDevice.Viewport.Width,
 graphicsDevice.Viewport.Height,0, 1.0f, 1000.0f) // Offset position
 PrimitiveType.LineStrip, vertexPositionColors,
 0, // vertex buffer offset to add to each element of the index buffer
 4, // number of vertices to draw
 0, // first index element to read
 4 // number of primitives to draw 

Here’s the result (white rectangle):


WPF ReactiveUI Binding and Routing Tutorial

Reactive UI clearly helps to write cleaner and more intuitive code, you just have to get used to bindings and thinking about Observables. There’s a lot of information and projects about Reactive UI but i didn’t find any project/tutorial showing a “complete” build just stubs or code excerptions.

So here’s my attempt to do it: https://github.com/kondaskondas/FirstsStepsRUI

This repository covers the basics; setting up the bootstrapper, bindings and routing. The demo just takes a username and password and has a side menu to change views.

Common “gotchas”:

  • Don’t forget to include System, System.Linq, System.Reactive.Linq and ReactiveUI namespaces to get all the extensions methods.
  • Use WhenAny for tracking changes of a property and WhenAnyValues to check and validate multiple properties
  • ReactiveCommand.CreateAsyncTask (And other Create functions) are only to hook the tasks to do (calling functions), do result validation, business logic, UI operations, etc. always on Subscribe(…).
  • If you’re updating UI from a Observable(Commands, Events, etc) do it on the Reactive MainThreadScheduler : ObserveOn(RxApp.MainThreadScheduler).Subscribe(…)
  • If the solution doesn’t looks simple, you are over thinking it or taking the wrong approach (Think with Observables or don’t).

Recommended reads:

ReactiveUI Docs

ReactiveUi Guidelines

LiveTemplates, they really save time for boilerplate (IViewFor, property + backing field + NotifyPropertyChanged, etc)

Still trying to figure out if using Caliburn.Micro is a good idea, the only benefit i see is property auto-wiring when doing simple views. If anyone has a good link for using both (Caliburn.Micro and ReactiveUI) don’t hesitate to tell me!. If you see an error on the code or a better approach please write a comment.