Fixed issue which triggered AmbiguousMatchException #227

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
@thewindev

In the ViewLocator for UWP apps, this line of code triggered an AmbiguousMatchException
var method = element.GetType().GetTypeInfo()
.GetDeclaredMethod("InitializeComponent");

In UWP apps, there are two methods called "InitializeComponent" for device specific family views, but one takes a Uri as a parameter, so when you call GetDeclaredMethod it will throw that exception.

I fixed this by calling GetDeclaredMethods() and choosing the first one, which doesn't have the Uri parameter.

@nigel-sampson

This comment has been minimized.

Show comment
Hide comment
@nigel-sampson

nigel-sampson Sep 9, 2015

Contributor

Thanks for this one, just want to spend some time doing research on when and where this exception shows up as I haven't run into while doing the same thing.

Contributor

nigel-sampson commented Sep 9, 2015

Thanks for this one, just want to spend some time doing research on when and where this exception shows up as I haven't run into while doing the same thing.

@thewindev

This comment has been minimized.

Show comment
Hide comment
@thewindev

thewindev Sep 9, 2015

I understand, what I did is just a quick fix. If you need any help in reproducing the error or you need a sample project please let me know.

I understand, what I did is just a quick fix. If you need any help in reproducing the error or you need a sample project please let me know.

@nigel-sampson

This comment has been minimized.

Show comment
Hide comment
@nigel-sampson

nigel-sampson Sep 16, 2015

Contributor

Thanks for bringing this up, I've committed a fix, pretty much similar to yours but double checks the parameter count to ensure we get the right one.

Contributor

nigel-sampson commented Sep 16, 2015

Thanks for bringing this up, I've committed a fix, pretty much similar to yours but double checks the parameter count to ensure we get the right one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment