I'm trying to write my first WPF application and it's throwing errors before the thing even loads.
It's a System.InvalidOperationException with the following message:
"Cannot modify this property on the Empty Rect."
Here are the last few values on the call stack:
at System.Windows.Rect.set_X(Double value)
at System.Windows.Media.Visual.PrecomputeContent()
at System.Windows.Media.Visual.PrecomputeRecursive(Rect& bboxSubgraph)
at System.Windows.Media.Visual.PrecomputeRecursive(Rect& bboxSubgraph)
at System.Windows.Media.Visual.PrecomputeRecursive(Rect& bboxSubgraph)
This seems to happen after my MainWindow.InitializeComponents() is called, but before any user interactions. I think it happens as the Application is setting all the window boundaries and such.
I resized my window a few times in the xaml design view. That seems to have instigated it. I've been on this one for hours. Can't find a way around to even begin testing.
3 replies to this topic
#1
Posted 15 July 2011 - 02:17 AM
|
|
|
#2
Posted 15 July 2011 - 07:16 AM
o right in case in matters. Windows 7, x64 quadcore. .NET 4 Visual Studio 2010
I've been fighting this error for about 6 hours so any help would be var nice. thanks.
I've been fighting this error for about 6 hours so any help would be var nice. thanks.
#3
Posted 15 July 2011 - 08:35 AM
can you post your XAML?
#4
Posted 15 July 2011 - 09:50 AM
I honestly don't think there's anything wrong with the xaml itself. It seems to be tied to the visual studio debug environment. I can run the program outside of visual studio without crashing - though nothing happens ( which is expected since this is my first socket app in c# and i cant debug the thing in studio...)
In the Application debug properties I had to uncheck "Enable the Visual Studio hosting process" to even get the error - If I DONT do this, all I get is a black screen. The black screen error isnt directly related to this. I get it just making an empty WPF app unless I uncheck "enable visual studio hosting process"
it feels like some of the WPF tools are really patchwork at the moment.
In the Application debug properties I had to uncheck "Enable the Visual Studio hosting process" to even get the error - If I DONT do this, all I get is a black screen. The black screen error isnt directly related to this. I get it just making an empty WPF app unless I uncheck "enable visual studio hosting process"
it feels like some of the WPF tools are really patchwork at the moment.
<Window x:Class="WpfTest.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Foreground="White" WindowStyle="SingleBorderWindow" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="414" d:DesignWidth="594" SizeToContent="Manual"> <Grid Background="White" Height="372" Width="564"> <Grid.ColumnDefinitions> <ColumnDefinition Width="218*" /> <ColumnDefinition Width="239*" /> </Grid.ColumnDefinitions> <TextBox Height="23" HorizontalAlignment="Left" Margin="12,12,0,0" Name="fldAddress" VerticalAlignment="Top" Width="203" /> <Button Content="Connect" Height="23" HorizontalAlignment="Left" Margin="11,11,0,0" Name="btnConnect" VerticalAlignment="Top" Width="75" Click="btnConnect_Click" Grid.Column="1" /> <Button Content="Host" Height="23" HorizontalAlignment="Left" Margin="208,12,0,0" Name="btnHost" VerticalAlignment="Top" Width="75" Click="btnHost_Click" Grid.Column="1" /> <TextBlock Height="273" HorizontalAlignment="Left" Margin="12,49,0,0" Name="fldChat" Text="" VerticalAlignment="Top" Width="540" Focusable="True" TextWrapping="Wrap" Background="#FFEBEBEB" Grid.ColumnSpan="2" /> <TextBox Height="23" HorizontalAlignment="Stretch" Margin="17,329,95,0" Name="fldText" VerticalAlignment="Top" Width="452" Grid.ColumnSpan="2" /> <Button Content="Send" Height="23" HorizontalAlignment="Right" Margin="0,329,12,0" Name="btnSend" VerticalAlignment="Top" Width="75" Click="btnSend_Click" Grid.Column="1" /> <Label Content="Not connected" Height="28" HorizontalAlignment="Left" Margin="92,10,0,0" Name="fldStatus" VerticalAlignment="Top" Width="113" IsEnabled="False" Grid.Column="1" /> </Grid> </Window>
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









