Reputation: 1781
In my Xamarin Forms project, all day I was receiving this very clear (not the sarcasm) error message
"Value cannot be null Parameter name: type"
Anyone have any ideas what can cause this?
ANSWER!!! Since they won't let me post a new answer
I was hitting my head against the wall slowly decomposing my code until I could figure out the exact cause of the problem. After much tedious deconstruction I discovered that I had an error in my GestureRecognizers
section. The problem was that I accidentally typed Command to try to pass a parameter instead of CommandParameter
.
My original code generating the error looked like this.
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="Value_Tapped" Command="language" />
</Label.GestureRecognizers>
The corrected code is this:
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="Value_Tapped" CommandParameter="language" />
</Label.GestureRecognizers>
I hope this helps someone else in the future.
Upvotes: 7
Views: 13074
Reputation: 81380
I managed to fix the issue after following every steps from this post:
bin
and obj
directories from each project in the solution (YourProject
, YourProject.Android
, YourProject.iOS
)Upvotes: 4
Reputation: 897
I had the same error, but different issue. I had a class with:
public int ID { get; set; } = 0;
public string PINLogin { get; set; } = "0";
public bool IsRecordable { get; set; } = false;
public string Picture{ get; set; } = "Picture";
public string Val1{ get; set; } = " ";
public string Val2{ get; set; } = " ";
After a few changes I removed Val1
and Val2
, but forgot to remove them from my ListView
and that error was show.
Upvotes: 1
Reputation: 1781
It appears if you try to set the Command property to something Xamarin Forms does not know you will get this error. If you get the error I suggest double checking all the non-intelisense correct parameters in your code.
Upvotes: 2