A little guide on dealing Xamarin errors

So… I  sank around 3 hours into fixing this across 2 days… Turns out there is nothing wrong with the Picker, nothing wrong with my solution… The issue was within Xamarin.

Mono just got confused and was killing everything…

While digging thru the logs of the output I found out that the issue was linked to XamlFilePathAttribute so while there was no direct thread related to my issue I found this post, and it saved my life bottom line to fix a variety of issues with this class:

  • Cleanup solution
  • Close Xamarin Studio/VS
  • Remove all .bin and .obj folders in all projects.
  • Open Xamarin Studio/VS and rebuild the solution.

The Rebuild word is key be sure to

ReBuild

And not just try to debug it again like I did. Now everything works perfectly:

Advertisements

The simplest of things…

In Xamarin Forms 2.3.4 they added a Bindable picker to the XAML as per this documentation:
https://blog.xamarin.com/new-bindable-picker-control-for-xamarin-forms/

But cut my dick off and call me daisy but I cannot get it to work… I made a list dedicated to it:


public ObservableCollection<string> MuscleGroups { get; private set; } = new ObservableCollection<string>();

Filling it in nice and proper


var muscles = await _workoutStore.GetMusclesAsync();
foreach (var muscle in muscles)
{
MuscleGroups.Add(muscle.Name);
}

Bound it in XAML:


<Picker ItemsSource="{Binding MuscleGroups}" SelectedItem="{Binding SelectedMuscle}" />

But it crashes as soon as I try to load the page, its been two hours after a long day of doing Python in the office, I need a break… Going to fix it tommorow.