I am developing a esri map project on silverlight. When i add custom user control as element layer, getting that error from browser:
Line: 56
Error: Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.ArgumentException:
Parameter name: height
at System.Windows.Rect..ctor(Double x, Double y, Double width, Double height)
at ESRI.ArcGIS.Client.LayerCanvas.ArrangeOverride(Size finalSize)
at System.Windows.FrameworkElement.ArrangeOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
This is weird, because i didnt write any code or something. And my map service works. i think the problem occurs at parsing xaml files. So;
mainpage.xaml is:
<UserControl x:Class="tbl.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"
xmlns:esri1="http://schemas.esri.com/arcgis/client/2009"
xmlns:lcl="clr-namespace:tbl"
d:DesignHeight="600" d:DesignWidth="800">
<Grid x:Name="LayoutRoot" Background="White">
<esri1:Map x:Name="esrimap">
<esri1:ArcGISTiledMapServiceLayer Url="http://.../ArcGIS/rest/services/.../MapServer">
</esri1:ArcGISTiledMapServiceLayer>
<esri1:ElementLayer>
<lcl:SilverlightControl1 esri1:ElementLayer.Envelope="495942.700915659,4509916.68364022,495942.700915659,4509916.683614022"></lcl:SilverlightControl1>
</esri1:ElementLayer>
</esri1:Map>
</Grid>
</UserControl>
and silverlightcontrol.xaml:
<UserControl x:Class="tbl.SilverlightControl1"
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="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
</Grid>
</UserControl>
Can anybody help me?
This is a bug in the ESRI control's ArrangeOverride
method. It is attempting to create a System.Windows.Rect
with a negative height.
The 4-argument constructor for System.Windows.Rect
only throws an ArgumentException if the width and/or height are negative. I had a quick play with this structure and can confirm this. I can also confirm that this constructor does not throw an exception if the height is NaN
, which surprised me.