Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6639301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:32:16+00:00 2026-05-25T23:32:16+00:00

I’m trying to preview a file with UIDocumentInteractionController. Seems simple enough but randomly the

  • 0

I’m trying to preview a file with UIDocumentInteractionController. Seems simple enough but randomly the app crashes with a SIGSEGV, and after a few hours trying all kind of hacks I just don’t get what’s missing.

This code is called from my UIViewController class :

void Initialize ()
{
    mInteractionControllerDelegate = new  UIDocumentInteractionControllerDelegateClass(this, mFile);
    mInteractionController = UIDocumentInteractionController.FromUrl(NSUrl.FromFilename(mFile.Name));
    mInteractionController.Delegate = mInteractionControllerDelegate;
}

mInteractionControllerDelegate and mInteractionController are member variables of my view controller class (I tried that, in order to make sure an event wasn’t firing on a variable that would have been GCed)

I present the preview on a button click (the part with the MPMoviePlayerViewController is working fine :

void btnShowTouchUpInside (object sender, EventArgs e)
{
    if (mFile.Name.EndsWith(".mpeg") || mFile.Name.EndsWith(".avi") || mFile.Name.EndsWith(".mpg"))
    {
        MPMoviePlayerViewController mp = new MPMoviePlayerViewController(NSUrl.FromString(mFile.VideoURL));
        this.PresentMoviePlayerViewController(mp);
    }
    else
    {
        InvokeOnMainThread(delegate {
            mInteractionController.PresentPreview(true);
        });;
    }
}

In some cases, the preview will work (small txt files for example : but I’m not sure of the file size => crash correlation). But if I try with some bigger png files for example (500 ko), I see the preview for a few seconds, and then then app crashes with the following stack trace :

Stacktrace:

at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging.void_objc_msgSend (intptr,intptr) <IL 0x00024, 0xffffffff>
at MonoTouch.Foundation.NSObject/MonoTouch_Disposer.Drain (MonoTouch.Foundation.NSObject) [0x0002a] in /Users/plasma/Source/iphone/monotouch/Foundation/NSObject.cs:305
at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <IL 0x00052, 0xffffffff>
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <IL 0x0009f, 0xffffffff>
at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x00038] in /Users/plasma/Source/iphone/monotouch/UIKit/UIApplication.cs:26
at MonoTouch.UIKit.UIApplication.Main (string[]) [0x00000] in /Users/plasma/Source/iphone/monotouch/UIKit/UIApplication.cs:31
at DTS.Application.Main (string[]) [0x00000] in /Users/seb/Projects/DTS/DTS/Main.cs:14
at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>

Native stacktrace:

0   DTS                                 0x000d1965 mono_handle_native_sigsegv + 343
1   DTS                                 0x0000ffb4 mono_sigsegv_signal_handler + 322
2   libSystem.B.dylib                   0x98a9f45b _sigtramp + 43
3   ???                                 0xffffffff 0x0 + 4294967295
4   ???                                 0x0d24837c 0x0 + 220496764
5   ???                                 0x077520d6 0x0 + 125116630
6   DTS                                 0x0000fd6f mono_jit_runtime_invoke + 1332
7   DTS                                 0x001ee239 mono_runtime_invoke + 137
8   DTS                                 0x0029e9ab monotouch_trampoline + 2527
9   Foundation                          0x0140e94e __NSThreadPerformPerform + 251
10  CoreFoundation                      0x00ea08ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
11  CoreFoundation                      0x00dfe88b __CFRunLoopDoSources0 + 571
12  CoreFoundation                      0x00dfdd86 __CFRunLoopRun + 470
13  CoreFoundation                      0x00dfd840 CFRunLoopRunSpecific + 208
14  CoreFoundation                      0x00dfd761 CFRunLoopRunInMode + 97
15  GraphicsServices                    0x0404c1c4 GSEventRunModal + 217
16  GraphicsServices                    0x0404c289 GSEventRun + 115
17  UIKit                               0x01ce0c93 UIApplicationMain + 1160
18  ???                                 0x09d540a3 0x0 + 164970659
19  ???                                 0x09d53e74 0x0 + 164970100
20  ???                                 0x09d53474 0x0 + 164967540
21  ???                                 0x09d532cc 0x0 + 164967116
22  ???                                 0x09d5341e 0x0 + 164967454
23  DTS                                 0x0000fd6f mono_jit_runtime_invoke + 1332
24  DTS                                 0x001ee239 mono_runtime_invoke + 137
25  DTS                                 0x001f0920 mono_runtime_exec_main + 669
26  DTS                                 0x001efd0a mono_runtime_run_main + 843
27  DTS                                 0x000a3c62 mono_jit_exec + 200
28  DTS                                 0x002a25eb main + 3838
29  DTS                                 0x000030c9 _start + 208
30  DTS                                 0x00002ff8 start + 40

Debug info from gdb:

/tmp/mono-gdb-commands.VWK7bK:1: Error in sourced command file:
unable to debug self

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Final clue : this is the code for the UIDocumentInteractionControllerDelegateClass (created from other questions on SO) :

public class UIDocumentInteractionControllerDelegateClass : UIDocumentInteractionControllerDelegate
{
    private UIViewController mViewController;
    private DTSVirtualFile mFile;

    public UIDocumentInteractionControllerDelegateClass(UIViewController viewController, DTSVirtualFile file)
    {
        mViewController = viewController;
        mFile = file;
    }

    public override UIViewController ViewControllerForPreview (UIDocumentInteractionController controller)
    {
        return mViewController;
    }

    public override UIView ViewForPreview (UIDocumentInteractionController controller)
    {
        return mViewController.View;
    }

    public override RectangleF RectangleForPreview (UIDocumentInteractionController controller)
    {
        return mViewController.View.Frame;
    }

    public override void DidEndPreview (UIDocumentInteractionController controller)
    {
        mFile.DeleteCopy();
    }

    public override void DidDismissOptionsMenu (UIDocumentInteractionController controller)
    {
        // TODO: Implement - see: http://go-mono.com/docs/index.aspx?link=T%3aMonoTouch.Foundation.ModelAttribute
    }

    public override void WillBeginPreview (UIDocumentInteractionController controller)
    {
        Console.WriteLine("WillBeginPreview");          
    }

    public override void WillBeginSendingToApplication (UIDocumentInteractionController controller)
    {
        // TODO: Implement - see: http://go-mono.com/docs/index.aspx?link=T%3aMonoTouch.Foundation.ModelAttribute
    }

    public override void WillPresentOpenInMenu (UIDocumentInteractionController controller)
    {
        // TODO: Implement - see: http://go-mono.com/docs/index.aspx?link=T%3aMonoTouch.Foundation.ModelAttribute
    }

    public override void WillPresentOptionsMenu (UIDocumentInteractionController controller)
    {
        // TODO: Implement - see: http://go-mono.com/docs/index.aspx?link=T%3aMonoTouch.Foundation.ModelAttribute
    }
}

When I debug I can step over PresentPreview fine, but it then crashes right afterwards. If I comment the PresentPreview line, no crash.

Any pointers, solutions ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T23:32:16+00:00Added an answer on May 25, 2026 at 11:32 pm

    There’s an ABI bug that affects MonoTouch when methods returns structs (not classes), like a RectangleF and leads to similar crashes. Device builds (using a different ABO) are not affected by this issue.

    A workaround is to avoid overriding methods that returns structure such as:

    public override RectangleF RectangleForPreview (UIDocumentInteractionController controller)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
Seemingly simple, but I cannot find anything relevant on the web. What is the
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I am trying to loop through a bunch of documents I have to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.