Share target Contract chrash after ReportCompleted

2

I am facing a problem with implementing a share target contract in a Windows 8 store application.

I am doing a file upload in the share target. After clicking on my share button I start with:

_shareArgs.ShareOperation.ReportStarted();
_shareArgs.ShareOperation.ReportSubmittedBackgroundTask();

Followe by uplaoding the files and awaiting their tasks. After that I call:

ShareOperation.ReportCompleted

When I call reportcompleted with the dispatcher the share cotnract doesn't throw an exception as long as the UI is kept open. without dispatcher it crashes with :

The operation cannot be completed because the window is being closed. (Exception from HRESULT: 0x802A0201)

When to UI is closed it always crashes with this exception.

The exception is thrown add the closing brackets of the buttonclick event handler.

Any Ideas on this one?

c#
windows
windows-runtime
share
windows-store-apps
asked on Stack Overflow Feb 18, 2013 by Drako

1 Answer

0

The error suggests you are updating the content of the Page that the share operation displayed after you called ReportCompleted. As ReportCompleted closes the window the page is hosted in, that will cause your error.

This is the same error you will get if you touch anything on a user interface after you have closed the containing window.

answered on Stack Overflow Jan 3, 2014 by user3157803 • edited Jan 3, 2014 by SeniorJD

User contributions licensed under CC BY-SA 3.0