# Drawing.Image.FromStream error

**URL:** <https://forums.fusetools.com/t/drawing-image-fromstream-error/5725>\
**Category:** Bug Reports\
**Created:** [December 4, 2017, 2:06pm UTC](https://forums.fusetools.com/t/drawing-image-fromstream-error/5725 "2017-12-04T14:06:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mircea](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@mircea](https://forums.fusetools.com/u/mircea)\
**Post date:** [December 4, 2017, 2:06pm UTC](https://forums.fusetools.com/t/drawing-image-fromstream-error/5725/1 "2017-12-04T14:06:21Z")

</div>

Hi  
I have a demo app that loads different pictures from a simple test server. The problem is that from time to time I get this error when navigating between sections (most of which have pictures)

```auto
[Viewport]: System.ArgumentException: Parameter is not valid.
   at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData)
   at System.Drawing.Image.FromStream(Stream stream)
   at Fuse.Resources.Exif.ExifDotNetImpl.FromByteArray(Byte[] bytes) in C:\Users\Mircea\AppData\Local\Fusetools\Packages\Fuse.Elements\1.4.0\Resources\Exif\Exif.uno:line 102
   at Fuse.Resources.Exif.ExifData.FromByteArray(Byte[] buffer) in C:\Users\Mircea\AppData\Local\Fusetools\Packages\Fuse.Elements\1.4.0\Resources\Exif\Exif.uno:line 32
   at Fuse.Resources.HttpImageSourceImpl.HttpCallback(HttpResponseHeader response, Byte[] data) in C:\Users\Mircea\AppData\Local\Fusetools\Packages\Fuse.Elements\1.4.0\Resources\HttpImageSource.uno:line 155
   at Experimental.Http.BinaryLoader.OnLoaded(HttpMessageHandlerRequest resp) in C:\Users\Mircea\AppData\Local\Fusetools\Packages\Experimental.Http\1.4.0\BinaryLoader.uno:line 51
   at Uno.Net.Http.HttpMessageHandlerRequest.DispatchClosure.Run() in C:\Users\Mircea\AppData\Local\Fusetools\Packages\Uno.Net.Http\1.4.3\HttpMessageHandlerRequest.uno:line 156
   at Fuse.UpdateManager.ProcessPostActionsImpl() in C:\Users\Mircea\AppData\Local\Fusetools\Packages\Fuse.Common\1.4.0\UpdateManager.uno:line 476

```

The error is fairly inconsistent since it happens at various times in different sections, despite the fact that they work as intended 95% of the time.

Here are parts of the code I use:

```auto
var picture = this.Picture.map(function(val) { 
	return common.baseURL + val 
});

```

```auto
<Circle Width="100%" BoxSizing="FillAspect" Aspect="1" ClipToBounds="true" >
	<ImageFill Url="{picture}" ContentAlignment="Center" StretchMode="UniformToFill" />
</Circle>

```

What I suspect happens is that the server rejects the call at some point, so my question is what happens in that case, if an imageFill call gets rejected (and not with a 404) and how could I debug it?

---

<div class="post-metadata">

**Author:** ![Uldis](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/uldis/32/657_2.png) [@Uldis](https://forums.fusetools.com/u/Uldis)\
**Post date:** [December 7, 2017, 10:49am UTC](https://forums.fusetools.com/t/drawing-image-fromstream-error/5725/2 "2017-12-07T10:49:11Z")

</div>

Hi mircea.

You should be able to put `WhileLoading` and `WhileFailed` on the `Circle`. These should get triggered with appropriate states from the `ImageFill`.

```auto
<Circle Width="100%" BoxSizing="FillAspect" Aspect="1" ClipToBounds="true" >
    <ImageFill Url="{picture}" ContentAlignment="Center" StretchMode="UniformToFill" />
    <WhileLoading>
        <!-- ... -->
    </WhileLoading>
    <WhileFailed>
        <!-- ... -->
    </WhileFailed>
</Circle>

```
