Bug 22787 - Imposible to run Document Provider Extension second time.
Summary: Imposible to run Document Provider Extension second time.
Status: RESOLVED DUPLICATE of bug 22933
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: XI 8.0.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: 8.0.0 (iOS 8)
Assignee: Rolf Bjarne Kvinge [MSFT]
Depends on:
Reported: 2014-09-09 12:32 UTC by Rustam Zaitov
Modified: 2014-09-16 12:32 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Rustam Zaitov 2014-09-09 12:32:12 UTC
XS: Version 5.4 (build 214)
Xamarin.iOS: Version:

Looks very similar to this

sample: NewBox
repo: private-samples
branch: master
commit: 99590e9c383f945b05b02c40ba65406800f8118b

This sample have 2 extensions within main app. One Document Picker Extension (NBox) and other is File provider Extension (NBoxFileProvider). So when I clean solution (via git clean -dfx) and delete app from simulator and then build and run – all works fine.
But if I build and run again (source is unchanged) then I have a problem (crash).

Step to reproduce.
1. clean sln and delete app from device
2. build and run
3. Play with app*
4. Stop debugging
5. Run app from device (not from XS)
6. Play with app* (you are able to play with app)
These steps show that crash is not relative to second app's run.

7. Build and run
8. Try to play with app* (you are not able to play with app)
This shows that crash relative to second build.

[*] Play with app means – tap on Open in left column. Tap Locations. Enable NBox extension. Tap Open again. You will see Untitled.txt (you needn't tap on this button). Press Done. Tap open again – you will see the same view with Untitled.txt button. Also you can open Device log (not crash log) via XCode. And you will see the following rows (when you tap on Open):
NBox[4894] <Warning>: 4
NBox[4894] <Warning>: DocumentPickerViewController ctor
NBox[4894] <Warning>: DocumentPickerViewController PrepareForPresentation
NBox[4894] <Warning>: UIDocumentPickerMode=Open
NBox[4894] <Warning>: OriginalUrl=
NBox[4894] <Warning>: ProviderIdentifier=com.xamarin.NewBox.NBoxFileProvider
NBox[4894] <Warning>: DocumentStorageUrl=file:///private/var/mobile/Containers/Shared/AppGroup/EC37384D-6110-4C47-A014-EB04704797E9/File%20Provider%20Storage

Look at ProviderIdentifier – this is not empty string. This means that iOS able to find FileProvider extension

But if you build and ran again. You will see the following rows:
NBox[4907] <Warning>: 4
NBox[4907] <Warning>: DocumentPickerViewController ctor
NBox[4907] <Warning>: *** Assertion failure in -[DocumentPickerViewController _prepareWithExtensionInfo:completionHandler:], /SourceCache/UIKit/UIKit-3302.3.1/UIDocumentPickerExtensionViewController.m:134
NBox[4907] <Warning>: Unhandled managed exception: Objective-C exception thrown.  Name: NSInternalInconsistencyException Reason: documentStorageURL is nil in Open or Move mode. (Foundation.MonoTouchException)

As you can see documentStorageURL is null. According to the apple doc this mean that you are NOT provider FileProviderExtension.
Proof: https://developer.apple.com/library/prerelease/mac/documentation/General/Conceptual/ExtensibilityPG/FileProvider.html
>> documentStorageURL. This read-only property contains the value returned by your File Provider extension’s documentStorageURL method. If you do not provide a File Provider extension, it returns nil

From my point of view iOS can't find second extension (FileProviderExtension).
This sample require iCloud. I created NewBoxDevelopment provisioning profile. So add your certificate to it and regenerate. (Sorry I can't create self-contained example without iCloud and provisioning profile's stuff)
Comment 1 Rustam Zaitov 2014-09-11 09:02:41 UTC
Still occurs for me
XS: Version 5.4 (build 221)
Xamarin.iOS: Version:
Comment 2 Rolf Bjarne Kvinge [MSFT] 2014-09-11 17:22:26 UTC
@Rustam, that's an old XI version by now, can you try latest from the monotouch-mlion-monotouch-8.0.0-branch lane?
Comment 3 Rustam Zaitov 2014-09-12 08:24:50 UTC
The same for 
XS: Version 5.4 (build 221)
Xamarin.iOS: Version:
Comment 4 PJ 2014-09-15 10:25:31 UTC
Rustam tried again, back to NEW.
Comment 5 Rolf Bjarne Kvinge [MSFT] 2014-09-16 12:32:23 UTC
This seems to work now, with the fix for bug #22933.

*** This bug has been marked as a duplicate of bug 22933 ***