[WinRT] Protocolactivation: Sequence contains more than one element



for some reason I Need to save a file in a share charm on WinRT. As FilePicker is not permitted in share charm, I decided to implement a protocol based call from share charm to my App. When doing so caliburn micro throws an exception "Sequence contains more than one element". Sample is attached. In the sample I added another button in main view, but same result.
Any Suggestion how to overcome this?

file attachments

Closed Jan 26, 2013 at 2:06 PM by tibel
Not an issue.


urgestein wrote Jan 25, 2013 at 3:44 PM


I implemented following Workaround, without knowing whether this is a General solution:
 public object GetInstance(Type service, string key)
            var entry = GetEntry(service, key);
            if (entry != null) {
#if !WinRT
                return entry.Single()(this);
                if (entry.Count() > 1)
                    return entry.Last()(this);   // Uncertain whether this is a good solution
                    return entry.Single()(this);                    

tibel wrote Jan 26, 2013 at 2:06 PM

This is not an issue and was already reported (http://caliburnmicro.codeplex.com/workitem/256).

Have a look at the Hello-WinRT Sample project how to implement OnShareTargetActivated:
protected override void OnShareTargetActivated(ShareTargetActivatedEventArgs args)
    // Normally wouldn't need to do this but need the container to be initialised

    // replace the share operation in the container
    container.UnregisterHandler(typeof(ShareOperation), null);


urgestein wrote Jan 26, 2013 at 3:14 PM

Hi tibel,

sorry my fault. I simply missed this line when copy/pasting...