100.5: SketchEditor EditConfiguration is null

321
3
Jump to solution
04-15-2019 02:13 PM
MarkCederholm
Regular Contributor II

Starting at 100.5, the EditConfiguration of the SketchEditor of the MapView is null, which causes my 100.4 code to crash.  How can I get it to be populated so that I can manipulate it?

0 Kudos
1 Solution

Accepted Solutions
MatveiStefarov
Esri Contributor

Hello, Mark!

Each time StartAsync is called on the SketchEditor, it creates a default SketchEditConfiguration with parameters that make sense for that particular shape (e.g. circles are scaled in an aspect-ratio-preserving way, but ellipses are not). The intended use of EditConfiguration property is to override these defaults after each StartAsync call, to modify the defaults based on context. Admittedly, this quirk was not well-documented. 

Previous versions of Runtime set EditConfiguration property to a placeholder object between operations. Confusingly, modifying that object didn't actually have any effect on the next operation, because calling StartAsync just replaced the object with a new one. Starting with Runtime 100.5, this property is set to NULL between operations. This behavior change draws attention to accidental misuse of this API -- the software affected by this change was already silently doing something unexpected.

To summarize, you can either use StartAsync overload which accepts a SketchEditConfiguration parameter, or modify EditConfiguration after calling StartAsync.

View solution in original post

3 Replies
MarkCederholm
Regular Contributor II

Looks like I need to use a different overload of StartAsync and pass in the EditConfiguration.

0 Kudos
MatveiStefarov
Esri Contributor

Hello, Mark!

Each time StartAsync is called on the SketchEditor, it creates a default SketchEditConfiguration with parameters that make sense for that particular shape (e.g. circles are scaled in an aspect-ratio-preserving way, but ellipses are not). The intended use of EditConfiguration property is to override these defaults after each StartAsync call, to modify the defaults based on context. Admittedly, this quirk was not well-documented. 

Previous versions of Runtime set EditConfiguration property to a placeholder object between operations. Confusingly, modifying that object didn't actually have any effect on the next operation, because calling StartAsync just replaced the object with a new one. Starting with Runtime 100.5, this property is set to NULL between operations. This behavior change draws attention to accidental misuse of this API -- the software affected by this change was already silently doing something unexpected.

To summarize, you can either use StartAsync overload which accepts a SketchEditConfiguration parameter, or modify EditConfiguration after calling StartAsync.

View solution in original post

MarkCederholm
Regular Contributor II

Huh, I thought my partial modes were working, but I guess I didn't explore thoroughly enough.  Thanks!

0 Kudos