Skip to content

Index out of range error #13

@markolbert

Description

@markolbert

I'm running into a problem reading a PSD file preparatory to displaying it in a WinUI3 app. Here's the code:

        foreach( var path in paths )
        {
            using var fs = File.Open( path, FileMode.Open, FileAccess.Read, FileShare.Read );

            var psdFile = PsdFile.Open( fs );
            // this next line throws the exception
            var image = psdFile.ImageData.ToImageSharpImage();
            
            var ms = new MemoryStream();
            image.SaveAsJpeg( ms );
            ms.Position = 0;

            var bitmap = new BitmapImage();
            bitmap.SetSource( ms.AsRandomAccessStream() );

            images.Add( bitmap );

The exception is "Index is outside the bounds of the array." It's being thrown from within System.Private.CoreLib.

Thoughts on what might be causing this, or which package I should clone and dig into to get more details?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions