Monday, January 26, 2015

Performance in Parallels

This post is going to a work-in-progress-post... The goal is to find what settings in Parallels that gives the best development experience using Visual Studio 2013.

The host is a MacBook Pro Retina with 16GB of ram.

My current settings for my Windows 8.1 virtual machine as of January 26th:

  • 8GB of memory
  • 4 CPU Cores
  • Enabled nested virtualization (for WP development)
  • 512 MB of video memory
  • DirectX 10 3D acceleration
  • Enabled Retina resolution

My environment is responsive but it's not good. The fan is constantly running and Parallels hogs about 300% of the CPU when I have Visual Studio and an WP Emulator running in Windows doing nothing but sitting idle.

As soon as I find my cable again, I'm going to turn off Nested Virtualization to see if that's the issue. Also I tried uninstalling Google Chrome that some posts recommend, but I'm unsure if that did any difference at all.

Please comment with your best tips for performance.

Tuesday, January 20, 2015

Cannot resolve dependency after updating Xamarin Forms to

If you're updating Xamarin.Forms to and get errors simular to this one:

Cannot resolve dependency to assembly 'Xamarin.Forms.Platform.WP8, Version=, Culture=neutral, PublicKeyToken=null' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.

Two ways around this.

Downgrade Xamarin Forms (to pre-release)

The first way is to downgrade to Xamarin.Forms.

Upgrade Xamarin Forms Labs (to pre-release)

The second way is to switch Xamarin Forms Labs to Xlabs.Forms. There is some breaking namespace changes in this update so you might want to prepare yourself for some refactoring of your code. Uninstall Xamarin Forms Labs and install XLabs.Form -pre.

NOTE ON THIS: It doesn't seem like all packages are in place just yet. For example XLabs.Platform.WP8  seems to be missing. I'm sure that this will be fixed shortly. Just reference the device specific assemblies manually.


So you're pretty much left with pre-release bits in one end or another in order to use the latest Xamarin Forms.


Thursday, January 15, 2015

The application could not be launched for debugging

Short version

If you're faced with the message "The application could not be launched for debugging. Ensure that the target device screen is unlocked and that the application is installed" when starting your Windows Phone project and you've recently installed Update 4 for Visual Studio 2013 then reinstall the update. If that doesn't work, follow the long version to get some hints on what to try next.

Long version

This message was thrown in my face by VS when trying to start a WP-project that I'm currently working on.

"The application could not be launched for debugging. Ensure that the target device screen is unlocked and that the application is installed."

Seemed to appear after I updated Visual Studio 2013 Ultimate to Update 4. My collegue running the same setup does not experience this issue, even after Update 4. The app gets installed but the debugger can't attach.

Most common scenarios to solve this seems to be the ones below, however it didn't work for me.

  • Deploy-option not checked in Configuration Manager
  • WP project is not set as the start up project
  • Corrupted auto-generated files (clean and/or delete obj/bin folders)

I went on to update the Windows phone 8.1 Update 1 SDK. You just need to download the MobileTools_EmulatorWP81GDR1.exe, it will fetch whatever stuff needed. If you want the entire installation offline, pick the .iso file.

Windows Phone 8.1 Update 1 SDK and Emulators

No luck there... Still the same message...

Restarting Windows? Nope...

Wndows update? (.NET Framework 4.5.2 found) Downloading, installing, not working.

Started a new project to see if there is something in my project causing this. But no...

Tried to change the language on the emulator. Parallels crashed. It's really not my day.

In the end, reinstalling Update 4 for Visual Studio 2013 was the thing that helped me. Download it from

Monday, January 12, 2015

Installing a Distribution Provisioning Profile on your iPhone

If you're using Visual Studio to develop your Xamarin app for iOS you probably aim to release it someday. One of the most important things to do then is to test the actual build that you plan to upload.

When you build the binaries to send to Apple you need to sign them with at distribution provisioning profile. To upload and run your ipa-file on an actual device you need to upload the same distribution provisioning profile to that Device. This guide already assumes that you have a profile set up.

The only way to add the profile at the moment is through Xcode.

There are a few simple steps to do so.

  1. Navigate to and sign in
  2. Find your distribution provisioning profile under "Certificates, Identifiers & Profiles"
  3. Download it to your local machine
  4. Make sure your device is connected
  5. Open Xcode and click Window -> Devices
  6. Right click your device and select "Show Provisioning Profiles..."
  7. Click the + sign at the bottom and add the downloaded profile.

The app should now run using the Appstore and Release configuration.


Make sure that these configurations actually build your PCL-project and any other reference projects needed.

Saturday, January 3, 2015

XamlParseException on build after altering the XAML-file in Xamarin Studio

As usual, there is a long and a short version.

Short version

If you get a Xamarin.Forms.Xaml.XamlParseException each time you edit a Xaml file in a project open in Xamarin Studio then edit your project config file and remove any MSBuild:Compile references in it.

Long version

Since I usually carry on my Xamarin development using Visual Studio, I thought it would be a good idea to use Xamarin Studio every once in a while. So for my new shiny blog post I fired up Xamarin Studio and started hacking. The post was going to be about animating rows in a standard Xamarin Forms Grid.

Not long in to my hacking I regularly run into this issue every time I make any changes to my Xaml.
Break point at the XamlParseException
The exception being Xamarin.Forms.Xaml.XamlParseException.

It seems to go away every time I clean the entire solution.

So I do what all code monkeys do, I google (or Bing if you're a Microsoft employee reading this). This leads me to a registered bug from earlier this fall that seems to be the same issue. (2014-07-03)

Not fixed, this should be fixed. It's highly annoying! :)


The workaround is to remove the element for each xaml file in the project file. So each time you add a new Xaml-file you need to edit the project file. 

Removing the <Generator> element
Take care!