alexrainman / ModernHttpClient

ModernHttpClient
MIT License
126 stars 27 forks source link

System.ObjectDisposedException: Cannot access a disposed object. #42

Closed rayita closed 4 years ago

rayita commented 4 years ago

In Android 4.4 (API 19) we are getting this exception:

System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Javax.Net.Ssl.SSLSocketFactoryInvoker'. at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in <3beddfcb1eb547cd8ce47c3097f6eaeb>:0 at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeAbstractObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00000] in <3beddfcb1eb547cd8ce47c3097f6eaeb>:0 at Javax.Net.Ssl.SSLSocketFactoryInvoker.CreateSocket (Java.Net.Socket s, System.String host, System.Int32 port, System.Boolean autoClose) [0x00078] in <ff9f3f3d4e134974a889db1b532c9b6e>:0 at ModernHttpClient.TlsSslSocketFactory.CreateSocket (Java.Net.Socket s, System.String host, System.Int32 port, System.Boolean autoClose) [0x00000] in <a0c6ec8b12f94a1d94e152e02e7d070b>:0 at Javax.Net.Ssl.SSLSocketFactory.n_CreateSocket_Ljava_net_Socket_Ljava_lang_String_IZ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_s, System.IntPtr native_host, System.Int32 port, System.Boolean autoClose) [0x00019] in <ff9f3f3d4e134974a889db1b532c9b6e>:0 at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.35(intptr,intptr,intptr,intptr,int,bool)

It not happends in all calls, it just happends randomly when application is running for a few seconds.

Seems to works right in other android versions.

alexrainman commented 4 years ago

I will release a new version with a possible fix for this issue. Please, try it as soon as it is out.

rayita commented 4 years ago

Seems to work.

Thanks!

desaishrey90 commented 4 years ago

Hello Alex, I am getting the same exception in android 4.4.3 but works fine on other OS versions. Is there any fix for this bug available?