jsmarcus / Xamarin.Plugins

Cross platform Xamarin and Windows controls and plugins
MIT License
195 stars 79 forks source link

Exception has been thrown by the target of an invocation. Invalid Cast Exception #114

Closed Jugs0101 closed 6 years ago

Jugs0101 commented 6 years ago

HI there,

VS 2017 on Windows 10 well spec'd machine, Xamarin, just trying Android at the moment. New to Xamarin, but not new to development in general.

Just trying to get the example code working to take a photo, but for the life of me I cannot get past this line, and I get an exception thrown.

            var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
            {
                Directory = "Sample",
                Name = "test.jpg"
            });

The exception is rather huge, but I think the key is the Invalid Cast Exception. I can't see anything else in the text to point me in the direction of what cast is incorrect. I can post the whole thing if anyone think it might be of help, but just wanted to simplify the question first in case anyone just says 'oh, yeah, it's this thing...' (!)

Does this ring any bells with anyone? Any help would be greatly appreciated.

Many thanks,

Jugs