×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Aug 2013
    Posts
    7

    'System.IndexOutOfRangeException' when using CreateEditingSessionAsync

    Hey Guys,

    Im having some issues using this SDK and Im hoping someone can help.

    I have a MemoryStream I have created from a writeable bitmap as such:

    Code:
    MemoryStream EditStream = new MemoryStream(); // stream for editing
    wb.SaveJpeg(EditStream, wb.PixelWidth, wb.PixelHeight, 0, 100); //wb being my writeablebitmap
    I then have an async function as such that is (supposed) to apply a filter to the imagestream and render it to an image on my XAML page named "display image":

    Code:
    async void processRendering()
     {
                
                //define session variable and instantiate an EditingSession
                using( EditingSession _session =   await EditingSessionFactory.CreateEditingSessionAsync(EditStream))
                {    
                    _session.AddFilter( FilterFactory.CreateAntiqueFilter() );    
                    await _session.RenderToImageAsync(displayImage);
                }
     }
    It all compiles fine, but when I run the app, the debuger breaks and i get the following output:

    An exception of type 'System.IndexOutOfRangeException' occurred in Nokia.Graphics.Imaging.Managed.DLL and wasn't handled before a managed/native boundary
    WinRT information: The text associated with this error code could not be found.

    A first chance exception of type 'System.IndexOutOfRangeException' occurred in mscorlib.ni.dll
    An exception of type 'System.IndexOutOfRangeException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
    An exception of type 'System.IndexOutOfRangeException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary

    I have done exactly what is instructed on the tutorials but I don't understand why I cant get this to work. Anyone have an ideas on what may be happening?

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    418

    Re: 'System.IndexOutOfRangeException' when using CreateEditingSessionAsync

    Hi.
    Have you try to reset stream position before create your editing session.

    Code:
    EditStream.Seek(0, SeekOrigin.Begin);

  3. #3
    Registered User
    Join Date
    Aug 2013
    Posts
    7

    Re: 'System.IndexOutOfRangeException' when using CreateEditingSessionAsync

    Hi Yan,

    I actually had tried that, but I tried it again and this time I set the width and height of the Image element in the XAML; it works! But I have a new problem now.

    I hadn't set the dimensions of the Image element because I was using a stretch function so that the image would fill the phone screen:

    displayImage.Stretch = Stretch.UniformToFill;

    This no longer works with the nokia SDKs requirement for me to set the image dimensions; do you have any way around this?

  4. #4
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    418

    Re: 'System.IndexOutOfRangeException' when using CreateEditingSessionAsync

    Sorry
    i don't understand your question
    Why do you need to set Image control dimension?
    What it's no longer works with the nokia SDKs requirement??

  5. #5
    Registered User
    Join Date
    Aug 2013
    Posts
    7

    Re: 'System.IndexOutOfRangeException' when using CreateEditingSessionAsync

    Actually I worked it out;

    Code:
    await _session.RenderToWriteableBitmapAsync(wb, OutputOption.PreserveAspectRatio);
    using that instead means I don't need to set width and height of image and the stretch property is maintained.

    Now I just need to fix the "tearing" I get as I change the filters via a slider

  6. #6
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    418

    Re: 'System.IndexOutOfRangeException' when using CreateEditingSessionAsync

    wb haven't same size factor of _session?

Similar Threads

  1. Replies: 2
    Last Post: 2012-04-03, 09:41
  2. Replies: 4
    Last Post: 2010-02-04, 18:04
  3. system.out and system.err redirector for S60 2nd edition phone
    By arpit2agrawal in forum Mobile Java General
    Replies: 8
    Last Post: 2009-06-12, 13:42
  4. How to get System time and system date
    By neel.soft in forum Symbian
    Replies: 5
    Last Post: 2009-03-03, 10:04
  5. broadcasting message system and receiver filter system
    By Nokia_Archive in forum Smart Messaging
    Replies: 1
    Last Post: 2002-05-20, 13:23

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •