Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.

[Bug] AvatarView does not load Initials on UriImageSource with HTTP 204 (no content) #1120

@jslachta

Description

@jslachta

Description

I am not sure whether this should go for Xamarin.Forms or XCT.

Let's say we have a list of persons. Some of them have a picture, and some of them do not have a picture.

In the case of HTTP status code 204 (HTTP status code for no content), the AvatarView shows empty AvatarView instead of showing Initials. In the case of HTTP status codes higher than 400, the AvatarView loads initials correctly.

I consider it as a bug because:

  • an entity not having a picture is an expected state. It is not an error (404). It is no-content (204).
  • the UriImageSource will return null stream on exception (HTTP status code >= 400)
  • exceptions should be exceptional, and exception handling is performance-hungry

Steps to Reproduce

<xct:AvatarView 
                    Grid.Row="0"
                    Grid.RowSpan="3"
                    Grid.Column="0"
                    FontSize="Medium"
                    Size="40"
                    Text="{Binding Initials}">
                    <xct:AvatarView.Source>
                        <UriImageSource 
                            CacheValidity="00:30:00"
                            CachingEnabled="True" 
                            Uri="{Binding ImageUrl}" />
                    </xct:AvatarView.Source>
</xct:AvatarView>
  1. For an AvatarView defined above provide in ImageUrl an Uri returning HTTP 204.

Expected Behavior

Providing an empty picture:

  • HTTP 200: empty AvatarView shown, no Initials
  • HTTP 204 - for no content I cannot provide a picture in response body: Initials shown
  • HTTP >=400: Initials shown

Actual Behavior

Providing an empty picture:

  • HTTP 200: empty AvatarView shown, no Initials (OK)
  • HTTP 204: empty AvatarView shown, no Initials (NOK)
  • HTTP >=400: Initials shown (OK)

Basic Information

  • Version with issue: 1.1.0
  • Last known good version: none
  • IDE: 16.9.2
  • Platform Target Frameworks:
    • iOS: not tested
    • Android: 11.0
    • UWP: not tested
  • Android Support Library Version: none
  • Nuget Packages:
  • Affected Devices: all

Workaround

Return HTTP status code >= 400.

Reproduction imagery

None.

Reproduction Link

None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working. Breaky break.needs-reproductionWe're not able to reproduce this ourselves, in need of a reproduction sample showing the issueneeds-samples/unverifiedThis issue needs verification/reproduction by a team member. PRs cannot be accepted/merged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions