Giter Club home page Giter Club logo

image-pipeline-windows's People

Contributors

nmyhremsft avatar phongcao avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

image-pipeline-windows's Issues

FetchEncodedBitmapImageAsync throws exception in UI thread when image is invalid

This is very similar to #12

I am trying to fetch an image using the following sample code:

private async void Button_Tapped(object sender, TappedRoutedEventArgs e)
{
    try
    {
        var uri = new Uri("https://avatar.skype.com/v1/avatars/pejacepoha?auth_key=-1104745216&cacheHeaders=true&returnDefaultImage=false&size=m");
        var imagePipeline = ImagePipelineFactory.Instance.GetImagePipeline();
        Debug.WriteLine("UI fetching image...");
        var bitmap = await imagePipeline.FetchEncodedBitmapImageAsync(uri);
        Debug.WriteLine("UI image fetched!");
    }
    catch
    {
        Debug.WriteLine("UI image fetching failed due to exception");
    }
}

As far as I can tell I am receiving a 200 OK code from the HTTPS request, but the image data is incorrect and has a content length of 1. Here is from Fiddler:

HTTP/1.1 200 OK
Cache-Control: max-age=604800
Content-Length: 1
Content-Type: image/jpeg; ver=1.0
Expires: Fri, 19 Jan 2018 21:23:48 GMT
Server: Microsoft-HTTPAPI/2.0
X-Avatar-Type: custom
X-Avatar-Size: s
X-Content-Type-Options: nosniff
X-Skype-Request-Id: cf84fb6b
X-Skype-Processing-Time: 59.91510
Date: Fri, 12 Jan 2018 21:23:48 GMT

I modified the Example code and I can see the exception is happening from this line in ImagePipelineCore.cs:

await bitmapImage.SetSourceAsync(outStream).AsTask().ConfigureAwait(false);

dataSource.Subscribe() fails for GIF based dataSource

var request = ImageRequestBuilder.NewBuilderWithSource(uri).Build();
var dataSource = imagePipeline.FetchDecodedImage(request, null);
...
dataSource.Subscribe(dataSubscriber, FBCore.Concurrency.CallerThreadExecutor.Instance);

fails with:

{System.NotImplementedException: The method or operation is not implemented. at ImagePipeline.Decoder.ImageDecoder.DecodeGifAsync(EncodedImage encodedImage, ImageDecodeOptions options)
at ImagePipeline.Producers.DecodeProducer.ProgressiveDecoder.d__13.MoveNext()}

for local GIF files (for example the one attached)

sending

Trying to open an image from ms-appdata URI fails with cast exception

I'm using react-native-windows 0.48.0-rc.8 which uses version 0.0.6 of image-pipeline-windows and I am getting a cast exception when trying to open an image file with an ms-appdata URI. Initially I was trying to open the image with a file URI (which used to work in react-native-windows 0.43 but now throws an unsupported URI type exception, that might qualify as another issue?).

The exception I get is:

System.InvalidCastException: 'Unable to cast object of type 'System.IO.DirectoryInfo' to type 'System.IO.FileInfo'.'

I believe this may be because of this code in ImageRequest.cs:

public FileSystemInfo SourceFile
        {
            get
            {
                lock (_gate)
                {
                    if (_sourceFile == null)
                    {
                        _sourceFile = new DirectoryInfo(SourceUri.LocalPath);
                    }

                    return _sourceFile;
                }
            }
        }

When I think it should be:

public FileSystemInfo SourceFile
        {
            get
            {
                lock (_gate)
                {
                    if (_sourceFile == null)
                    {
                        _sourceFile = new FileInfo(SourceUri.LocalPath);
                    }

                    return _sourceFile;
                }
            }
        }

Nuget ref error when compiling React-Native-Windows using VS2017

The latest Nuget + VS 2017 release does not like the nuspec in version 0.03 of the fresco.imagepipeline. Below is a snippet of the errors. I believe we need to add a ref for each class assembly to be compliant.

NU1203: fresco.imagepipeline 0.0.3 provides a compile-time reference assembly for FBCore_stub on UAP,Version=v10.0.10240, but there is no run-time assembly compatible with win10-arm.
NU1203: fresco.imagepipeline 0.0.3 provides a compile-time reference assembly for ImagePipelineBase_stub on UAP,Version=v10.0.10240, but there is no run-time assembly compatible with win10-arm.
NU1203: fresco.imagepipeline 0.0.3 provides a compile-time reference assembly for ImagePipeline_stub on UAP,Version=v10.0.10240, but there is no run-time assembly compatible with win10-arm.
NU1203: fresco.imagepipeline 0.0.3 provides a compile-time reference assembly for ImagePipeline

HTTP redirect is not supported.

When HTTP server returns redirect response fetch request fails with exception, for example this response:

HTTP/1.1 302 Found
Cache-Control: max-age=604800, s-maxage=0, private
Location: new_url
Server: Microsoft-IIS/8.5
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Powered-By: ARR/2.5
X-Powered-By: ASP.NET
Date: Mon, 05 Mar 2018 14:38:28 GMT
Content-Length: 0

ends with exception:
{System.IO.IOException: URL new_url returned Found without a valid redirect at ImagePipeline.Producers.HttpUrlConnectionNetworkFetcher.d__12.MoveNext()

AutoRotate and ResizeOptions don't work

These two features are implemented using libjpeg-turbo (same as Android). Since libjpeg-turbo currently has some unsupported APIs and it fails Windows App Certification Kit, we'll disable them for now.

FetchEncodedBitmapImageAsync crashes app when URI returns a 204

I put the following code into an event handler to repro this bug:

private async void Button_Tapped(object sender, TappedRoutedEventArgs e)
{
    try
    {
        var uri = new Uri("https://avatar.skype.com/v1/avatars/live:adam.comella/public?returnDefaultImage=false");
        var imagePipeline = ImagePipelineFactory.Instance.GetImagePipeline();
        Debug.WriteLine("UI fetching image...");
        var bitmap = await imagePipeline.FetchEncodedBitmapImageAsync(uri);
        Debug.WriteLine("UI image fetched!");
    }
    catch
    {
        Debug.WriteLine("UI image fetching failed due to exception");
    }
}

The result is that this exception is thrown:

The component cannot be found. (Exception from HRESULT: 0x88982F50) 

An interesting thing about that image's URI is that it returns an HTTP status code of 204 No Content rather than 200 OK.

An interesting thing about the exception is that it results in the app crashing even though the call to FetchEncodedBitmapImageAsync is wrapped in a try/catch. Do you know why that is?

This bug is causing my react-native-windows application to crash.

Adam Comella
Microsoft Corp.

Unsupported URI exception thrown for file URIs

Coming from the react native side we used to be able to use file URIs as long as they resolved to an accessible directory for UWP. This allowed easier URI building and use with other plugins like react-native-fs for downloading and accessing images. Could file URIs be allowed and treated like ms-appdata URIs?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.