Am I fundamentally misunderstanding how Silverlight runs? (debugging issues)
Posted
by
SP
on Stack Overflow
See other posts from Stack Overflow
or by SP
Published on 2011-01-07T20:35:21Z
Indexed on
2011/01/07
20:54 UTC
Read the original article
Hit count: 214
ASP.NET
|Silverlight
I've got a vs2010 solution containing an ASP.Net 4 website, and a Silverlight 4 project.
The website is linked to the Silverlight project ('Map') and the ClientBin folder contains a Map.xap file.
The Map project is very simple. It contains the default App.xaml and App.xaml.cs files. The MainPage.xaml file looks like this
<UserControl x:Class="Map.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="380" d:DesignWidth="800">
<Canvas x:Name="MainCanvas" Width="800" Height="380">
<Canvas.Background>
<ImageBrush ImageSource="map.png" Stretch="None"/>
</Canvas.Background>
</Canvas>
The code behind for that looks like this:
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
throw new Exception();
}
}
Inside one of the website pages I have the default object pointing to my Silverlight xap
When I run the website, I see my background image on the Canvas in the Silverlight window, so I know it's working in that sense. However, I cannot break on any breakpoints set in the MainPage.xaml.cs file (in IE). I have checked the correct settings for Silverlight debugging.
And see that Exception I'm throwing in the MainPage constructor? I'm not seeing that either. In fact, nothing I put in there seems to be run at all, but I know the xaml is rendering because I can see my canvas background. What am I not getting here?
© Stack Overflow or respective owner