AdaptiveCards icon indicating copy to clipboard operation
AdaptiveCards copied to clipboard

BUG: Setting Size = ImageSize.Auto does not render in JSON object

Open qpongo opened this issue 9 years ago • 2 comments

"size": "auto" is being dropped when looking at the JSON that the C# classes create and it breaks the rendering of my card when using ImageRenderer or VS Code Viewer (for example).

REPRO: Construct the card in C# which has an image with Size = ImageSize.Large and look at the JSON that you get

ACTUAL: size is dropped from the JSON

EXPECTED: "size": "auto" should be in my Json just like "size": "large" is there when I use large.

                                new Image()
                                    {
                                        Size = ImageSize.Large,
                                        Url = $"http://....",
                                    }

Viewing JSON with...

string json = JsonConvert.SerializeObject(card, Formatting.None);

Rendering with...


            ImageRenderer renderer = new ImageRenderer(new HostConfig(), String.Empty);
            Stream stream = await renderer.RenderAdaptiveCardAsync(card, 600);

I would have added the fix but didn't see where this is happening on my first dig. I'm guessing you figured it wasn't necessary because maybe 'auto' is the default but someone else isn't making the same assumption.

qpongo avatar Jul 16 '17 17:07 qpongo

I can confirm that image render works correctly in the current master build but will let you close the bug in case it jogs your brain from something related.

I didn't see the change here that resolved it but I could be wrong.

https://github.com/Microsoft/AdaptiveCards/pull/469

qpongo avatar Jul 16 '17 20:07 qpongo

This should be fixed in the latest .NET packages

matthidinger avatar Nov 11 '17 00:11 matthidinger