Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Can anyone explain this windows behaviour?

$
0
0

Hello,
Can anyone explain to me why this code throws an unauthorized exception (only on windows):

    public App()
    {
        var page = new ContentPage();
        page.Content = new Button
        {
            Text = "Change content",
            Command = new Command(async () =>
            {
                Task<Label> t = Task.Run(() =>
                {
                    return new Label { Text = "abc", FontSize = 22 };
                });

                await t;

                page.Content = t.Result;
            })
        };

        MainPage = page;
    }

And it does not throw an exception when I don't set the FontSize ?


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>