During the development I experience unhandled exceptions at random occasions, but mostly after closing the application. Setting all options on 'break on exceptions' does not trigger any code. Anyone who experience the same behaviour. I am developing on the release preview build and visual studio RC build.
First steps I did to resolve the problem is to:
And start debugging. This will take a few minutes to start to load all symbols....
I traced it down to several exceptions when binding to an Bitmap of which the URL did not resolve. The binding was of a GridView to the SmallImageSource bitmap property of a class. When debugging this will give an exception in native code, but doesn’t trace to the output window or give an exception in the application. Eventually my application crashed… After fixing these resources my application did not crash anymore. Although this is not reproducible in a small scenario. Below a small bit of application code on which it crashed. the GridView was embedded in a SemanticZoom control
XAML (used in a semanticzoom control)
<GridView.ItemTemplate>
<DataTemplate>
<Grid Background="Gray" Width="300" Height="80">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Image Source="{Binding Group.Key.SmallImageSource}" Stretch="Uniform" Margin="15" Grid.Column="0"/>
<TextBlock Text="{Binding Group.Key.Name}" Margin="0,10" TextAlignment="Center" Grid.Column="1" VerticalAlignment="Center"/>
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
C# (here is an URI which does not resolve to a local resource)
public Uri SmallImage
{
get
{
return new Uri("ms-appx:///Resources/Images/SubCategories/" + Id + "_" + FunctionHelper.StripCharacter(Name) + ".png", UriKind.Absolute);
}
}
public BitmapImage SmallImageSource
{
get
{
return new BitmapImage(SmallImage);
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With