Select to view content in your preferred language

Agentryclient.exe crashes with an error 'attempt by esrimapviewcontroller.initializeEdit() to access method 'Esri.arcgisruntime.controls.viewbase.get_editor()' failed'

1183
7
02-02-2018 08:13 AM
HajiraSyeda
Emerging Contributor

Hi,

Our Agentry WPF client integrated with ESRI runtime dll crashes with below error:

Attempt by 'AgentryClientControls.EsriMap.EsriMapViewController.InitializeEdit() to access method 'Esri.ArcgisRuntime.Controls.Viewbase.get_Editor()' failed

We are using arcgisruntime 10.2.7 version with Agentry v70.14.8.2

We have tried to use later ESRI Runtime versions like 100.2 but this is incompatible with the Agentry client as it crashes immediately with an error 'System operation failed'.

Your help is appreciated.

Thanks!

0 Kudos
7 Replies
dotMorten_esri
Esri Notable Contributor

The crash exception seems to indicate an issue with your app framework, rather than the app. Could you also share the stack trace, or even better a small sample that reproduces the issue, to confirm?

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

Please can you provide more information?

e.g.

- Can you share the section of code where the call is made to `Esri.ArcgisRuntime.Controls.Viewbase.get_Editor()?

- Did this previously work and now fails or has this never worked?

- Do you only see this error on specific machines / configurations?

- Are you able to reproduce outside with code outside of `AgentryClientControls.EsriMap.EsriMapViewController`?

Cheers

Mike

0 Kudos
HajiraSyeda
Emerging Contributor

Hi Mike & Morten,

Thanks for your responses. Here are a few more details for our problem.

This error was seen in our Windows Agentry client (a frontend client for SAP Work Manager used by field personnel) that has been integrated with ESRI runtime libraries for enabling GIS services.

When 'debug the program' option is selected; Microsoft Visual Studio launches with below error:

These ESRI runtime dll files used in our Agentry client folder are delivered on the ESRI website (http://resources.arcgis.com/en/communities/  ) under ArcGIS Runtime SDK for .NET. We are using 10.2.7 as the latest version 100.* is not compatible with our agentry client.

The error that has been reported is thrown from AgentryClientGISControls.dll file --class AgentryClientControls.EsriMapViewController method InitializeEdit(). I am unable to find where in this method the call to get_editor() method is performed.

The called method is apparently inside Esri.ArcGISRuntime.dll under Controls.Viewbase. However there is no such method called get_editor() under here.

I have attached both the dll files here for your review - AgentryClientGISControls.dll & Esri.ArcGISRuntime.dll. 

I hope this is more information than what was originally sent and you can help us further.

This functionality never worked previously and this issue occurs only on the Windows client and not on the Android client used on the tablets.

Thanks!

0 Kudos
dotMorten_esri
Esri Notable Contributor

get_Editor is the property getter method for Editor, which seems to be hit in the very first line of your Initialize code (this.mv.Editor). One thing to consider is that you must be on the MapView's UI thread to access any dependency property, so this might be it.

It could also be related to the security context that your client is running the app in which causes this exception to be thrown. Here's a few resources:

https://stackoverflow.com/questions/12092435/system-methodaccessexception-attempt-by-security-transp...

0 Kudos
HajiraSyeda
Emerging Contributor

Thanks for your response Morten.

However since this code is a pre-packaged dll from ESRI , I am not sure how I can change the location of MapView's UI thread and so on. We are using out of the box integration with ESRI runtime libraries.

If there is anything to be done with regard to the dll files on the windows side; like trusting them etc; please let me know. I tried to assign full control to the AgentryGISControls.dll and ESRI.ArcGISRuntime.dll by going into their security options; however it made no difference and the same error still appears

Below is how the files look on our file folder for the Agentry client:

0 Kudos
dotMorten_esri
Esri Notable Contributor

The UI Thread is created by your application, not the Runtime library. So it's on you to ensure you use the controls on the correct thread that you own.

Again I'm not sure how the framework you're running it under works, but I'm 99.99% sure the error you're getting is because of that framework, how you deploy or your code. As you pointed out, the error is thrown in your code, when trying to access a simple property on our control. There's really not much we could be doing there, that could cause this.

Without a stand-alone application that reproduces the problem, it's hard for me to suggest any real workaround. The only thing I can think of is checking if you're on the UI thread, if that's in fact the issue here.

            if(System.Windows.Application.Current.Dispatcher.CheckAccess())
            {
                //We're on the UI Thread
            }

As with any ViewModel object, you should make sure it's created on the UI thread (and secondary in the MVVM pattern a view model shouldn't actually have access to the View objects like you're code is doing)

0 Kudos
HajiraSyeda
Emerging Contributor

Thanks Morten.

The issue is now clearer to me. I will try to delve more into this and reach back in case of additional queries.

0 Kudos