I have a class for flashing geometry (attached) which worked just fine in the beta. In the release, however, the app crashes with an access violation if the geometry is an envelope. If I build a polygon from the envelope and use that instead, the error goes away. Weird, huh? Any idea why this might be happening?
Hi Mark,
Thank you. This is very helpful. I can reproduce the issue consistently even without your helper class. GraphicsLayer with labeling enabled crashes with AccessViolationException when it contains an Envelope geometry. I have logged an issue and we'll try to get it fixed in future releases.
Do you mind sharing the sample code for flashing geometry that uses Envelope? I can't seem to see attachment.
I can see it on my post: clsGraphicHelper.cs.zip 1.7K
Sorry, I was looking from a expanded view of your post from the main landing page: ArcGIS Runtime SDK for .NET I didn't realize attachments are only visible from within the message.
Anyway, I used your helper class with this very simple sample. I commented out the workaround of replacing g with PolygonBuilder but I'm not able to reproduce the issue. It seems to work without AccessViolationException. I ran the sample against the final released version 10.2.4.748
xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
<Grid x:Name="LayoutRoot"
Background="White">
<esri:MapView x:Name="MyMapView">
<esri:Map >
<esri:ArcGISTiledMapServiceLayer ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" />
<esri:GraphicsLayer ID="MyLayer" />
</esri:Map>
</esri:MapView>
<StackPanel Orientation="Horizontal"
VerticalAlignment="Top"
HorizontalAlignment="Center">
<Button Content="Flash"
Click="Button_Click" />
</StackPanel>
</Grid
private async void Button_Click(object sender, RoutedEventArgs e)
{
string message = null;
try
var geometry = await MyMapView.Editor.RequestShapeAsync(DrawShape.Envelope);
var graphic = new Graphic() { Geometry = geometry, Symbol = new SimpleFillSymbol() };
var layer = MyMapView.Map.Layers["MyLayer"] as GraphicsLayer;
layer.Graphics.Add(graphic);
clsGraphicHelper.FlashGeometry(MyMapView, geometry, geometry.Extent.GetCenter());
}
catch (TaskCanceledException)
catch (Exception ex)
message = ex.Message;
if (!string.IsNullOrWhiteSpace(message))
MessageBox.Show(message);
The problem is using FlashGeometry with an Envelope on a graphics layer with a label class:
public MainWindow()
InitializeComponent();
TextSymbol txtSym = new TextSymbol();
AttributeLabelClass lc = new AttributeLabelClass();
lc.Symbol = new TextSymbol();
lc.TextExpression = "[SomeFieldName]";
layer.Labeling.LabelClasses.Add(lc);
layer.Labeling.IsEnabled = true;
var geometry = await MyMapView.Editor.RequestShapeAsync(DrawShape.Rectangle);
//geometry = geometry.Extent; // Uncomment this line to make app crash
I see this is fixed at 10.2.5. Thanks.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.