question

Subramaniam .. avatar image
Subramaniam .. asked ·

IDynatrace.SetupHttpClient causing issue

I am trying to integrate Dynatrace to Xamarin forms project. In PCL, I had called IDynatrace.SetupHttpClient as mentioned in https://www.nuget.org/packages/Dynatrace.OneAgent.Xamarin

IDynatrace dynatrace = DependencyService.Get<IDynatrace>();
dynatrace.SetupHttpClient(httpClient);
var response = httpClient.GetAsync(uri).Result;

In the above mentioned scenario, the httpClient never returns. The entire program app goes to not responding mode. In case of calling the GetAsync without passing the httpClient to SetupHttpClient, it works fine. Please find below the output log

08-09 11:06:28.229 D/Mono    ( 6115): Assembly Ref addref Dynatrace.OneAgent.Forms.Android[0xf0f3ab20] -> System.Net.Http[0xc70aaf20]: 5
08-09 11:06:28.230 D/Mono    ( 6115): Unloading image System.Collections.dll [0xc7025a00].
08-09 11:06:28.230 D/Mono    ( 6115): Image addref System.Collections[0xc706e100] -> System.Collections.dll[0xcb6dcf00]: 9
08-09 11:06:28.230 D/Mono    ( 6115): Config attempting to parse: 'System.Collections.dll.config'.
08-09 11:06:28.230 D/Mono    ( 6115): Config attempting to parse: '/Users/builder/jenkins/workspace/xamarin-android-d15-9/xamarin-android/external/mono/sdks/out/android-armeabi-v7a-release/etc/mono/assemblies/System.Collections/System.Collections.config'.
08-09 11:06:28.230 D/Mono    ( 6115): Assembly Ref addref Dynatrace.OneAgent.Forms[0xf0f3ab80] -> System.Collections[0xcb7306e0]: 8
08-09 11:06:36.962 D/Mono    ( 6115): Assembly Ref addref Dynatrace.OneAgent.Forms.Android[0xf0f3ab20] -> Dynatrace.OneAgent.Android[0xf0f3a760]: 2
08-09 11:06:36.962 D/Mono    ( 6115): Assembly Ref addref Dynatrace.OneAgent.Forms.Android[0xf0f3ab20] -> System[0xcb7305c0]: 15
08-09 11:06:36.964 D/Mono    ( 6115): Assembly Ref addref Dynatrace.OneAgent.Android[0xf0f3a760] -> Java.Interop[0xe6226f20]: 3
08-09 11:06:36.991 D/Mono    ( 6115): Assembly Ref addref ModernHttpClient[0xf0f3ae80] -> System[0xcb7305c0]: 16
08-09 11:06:36.993 D/Mono    ( 6115): Assembly Ref addref ModernHttpClient[0xf0f3ae80] -> System.Core[0xe6227100]: 14
08-09 11:06:37.033 D/Mono    ( 6115): DllImport searching in: '__Internal' ('(null)').
08-09 11:06:37.033 D/Mono    ( 6115): Searching for 'java_interop_jnienv_new_object_array'.
08-09 11:06:37.033 D/Mono    ( 6115): Probing 'java_interop_jnienv_new_object_array'.
08-09 11:06:37.033 D/Mono    ( 6115): Found as 'java_interop_jnienv_new_object_array'.
08-09 11:06:37.034 D/Mono    ( 6115): DllImport searching in: '__Internal' ('(null)').
08-09 11:06:37.034 D/Mono    ( 6115): Searching for 'java_interop_jnienv_set_object_array_element'.
08-09 11:06:37.034 D/Mono    ( 6115): Probing 'java_interop_jnienv_set_object_array_element'.
08-09 11:06:37.035 D/Mono    ( 6115): Found as 'java_interop_jnienv_set_object_array_element'.
Thread started:  #8
08-09 11:06:39.765 D/Mono    ( 6115): Assembly Ref addref Square.OkHttp3[0xe6226320] -> Square.OkIO[0xe6226380]: 2
08-09 11:06:39.769 D/Mono    ( 6115): DllImport searching in: '__Internal' ('(null)').
08-09 11:06:39.769 D/Mono    ( 6115): Searching for 'java_interop_jnienv_call_int_method'.
08-09 11:06:39.769 D/Mono    ( 6115): Probing 'java_interop_jnienv_call_int_method'.
08-09 11:06:39.769 D/Mono    ( 6115): Found as 'java_interop_jnienv_call_int_method'.
08-09 11:06:39.830 D/Mono    ( 6115): DllImport searching in: '__Internal' ('(null)').
08-09 11:06:39.830 D/Mono    ( 6115): Searching for 'java_interop_jnienv_call_nonvirtual_boolean_method_a'.
08-09 11:06:39.830 D/Mono    ( 6115): Probing 'java_interop_jnienv_call_nonvirtual_boolean_method_a'.
08-09 11:06:39.830 D/Mono    ( 6115): Found as 'java_interop_jnienv_call_nonvirtual_boolean_method_a'.
Thread finished: <Thread Pool> #5
The thread 0x5 has exited with code 0 (0x0).
Thread finished: <Thread Pool> #3
Thread started: <Thread Pool> #9
The thread 0x3 has exited with code 0 (0x0).
Thread finished: <Thread Pool> #6
The thread 0x6 has exited with code 0 (0x0).
Thread finished:  #8
The thread 0x8 has exited with code 0 (0x0).
Thread finished: <Thread Pool> #4


Any help is highly appreciated.

Dynatrace Managedoneagentmobile monitoringoneagent sdk
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Sebastian K. avatar image
Sebastian K. answered ·

Do you have any errors visible on log output?

Sebastian

2 comments Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

I have updated the question with output log

0 Likes 0 · ·

I checked the logs and confirmed that the logs generated while calling GetAsync in both the cases are same.

0 Likes 0 · ·
Matthias H. avatar image
Matthias H. answered ·

We had the exact same issue a few days ago. This customer resolved it himself. I am currently trying to reproduce this issue. Where did you fire the web request? In which context?

2 comments Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

The web request call happens from PCL on App startup. Any idea how the customer resolved this issue?

0 Likes 0 · ·

Thanks for the info I will try to reproduce this. The other customer also triggered the request in the onCreate. The customer had a call something like this "MyMethod().GetAwaiter().GetResult();" and changed it to "Task.Run(MyMethod).ConfigureAwait(false).GetAwaiter().GetResult();"


This is everything I known about this case. But as mentioned above I will try to reproduce.

0 Likes 0 · ·
Matthias H. avatar image
Matthias H. answered ·

I can reproduce the issue and I think I fixed it. Is there a way to get in touch with you so we can test the new package upfront and confirm that the problem was fixed on your side as well?

1 comment Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Please reach me at gokulb1988(at)gmail(dot)com. I can give it a try with the new package and let you know the result.

I had raised another issue for which I didn't get any solution. It would be really helpful if you could take a look at https://answers.dynatrace.com/spaces/482/dynatrace-open-qa/questions/226130/missing-assembly-error.html as well. Please note that the assembly error occurs only in mac environment. I am able to compile the same code in windows environment.

0 Likes 0 · ·