WebView HtmlWebViewSource crashing the app

masroorejaz1985masroorejaz1985 Member ✭✭
edited January 10 in Xamarin.Forms


I want to display html text using webview. Currently I am testing it on UWP. Problem is whenever I use WebView in my current XAML code it's crashes the app and throw exception on the last page. I even tried using some hard quote value but even that's not working.

My XAML Code:


        <Image x:Name="ProductDetailsImage" WidthRequest="200" HeightRequest="200"></Image>
        <Label x:Name="ProductDetailsName" ></Label>
        <Label x:Name="ProductDetailsStartingFrom" ></Label>
        <Label x:Name="ProductDetailsBrand" ></Label>
        <Label x:Name="ProductDetailsSKU" ></Label>
        <Label x:Name="ProductDetailsMPN" ></Label>
        <Label x:Name="ProductDetailsStockStatus" ></Label>
        <Label x:Name="ProductDiscontinued" Text="Non-Returnable" IsVisible="False" ></Label>

        <Picker x:Name="SelectColorPicker" ItemDisplayBinding="{Binding name_str}" 
                SelectedItem="{Binding option_value_id}" IsVisible="False" Title="Select Color:"

        <Picker x:Name="SelectSizePicker" ItemDisplayBinding="{Binding name_str}"
                SelectedItem="{Binding option_value_id}" IsVisible="False" Title="Select Size:" 

        <Label Text="Enter Quantity: " x:Name="LabelQty" IsVisible="False"></Label>
        <Entry x:Name="ProductQty" Text="1" IsVisible="False"></Entry>
        <Button x:Name="AddToCart" Text="Add to Cart" IsVisible="False" Clicked="AddToCart_Clicked"></Button>
        <Button x:Name="AddToWishlist" Text="Add to Wishlist" IsVisible="False" Clicked="AddToWishlist_Clicked"></Button>     

        <WebView HeightRequest="100" WidthRequest="100">
                <HtmlWebViewSource x:Name="ProductHtmlWebViewSource"></HtmlWebViewSource>


Code Behind:

ProductHtmlWebViewSource.Html = product.data.descriptions;

Any help would be appreciated.

Thank you

Best Answer


  • JoeMankeJoeManke USMember ✭✭✭✭✭

    What is the exception?

  • masroorejaz1985masroorejaz1985 Member ✭✭

    It is throwing System.ArgumentNullExcption

    Exception thrown: 'System.ArgumentNullException' in System.Private.CoreLib.dll
    The thread 0x1154 has exited with code 0 (0x0).
    The thread 0x3488 has exited with code 0 (0x0).
    An exception of type 'System.ArgumentNullException' occurred in System.Private.CoreLib.dll but was not handled in user code
    Value cannot be null.

    The program '[1472] NayaDemoApp.UWP.exe' has exited with code -1 (0xffffffff).

  • masroorejaz1985masroorejaz1985 Member ✭✭

    Thanks a lot for the help @JoeManke

    It's working fine now.

Sign In or Register to comment.