Search Issue Tracker

Fixed in 2020.1.X

Votes

2

Found in

2018.3.0a1

2018.4.0f1

2019.1.0a1

2019.1.3f1

2019.2.0a1

2019.3.0a1

Issue ID

1157345

Regression

Yes

"Cannot access a disposed object" exception when processing requests simultaneously with a specified timeout

Mono

-

Steps to reproduce:
1. Open user-supplied project ("BugReport.zip")
2. Run Scene "SampleScene"

Expected: no error is thrown
Actual: error is thrown after a couple of seconds

Reproduced in: 2018.3.0a1, 2018.4.2f1, 2019.1.4f1, 2019.2.0b5, 2019.3.0a5
Not reproduced in: 2017.4.29f1

Note:
Full error:
Uncatchable thread exception: System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. ---> System.ObjectDisposedException: Cannot access a disposed object.

Object name: 'MobileAuthenticatedStream'.

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <1f0c1ef1ad524c38bbc5536809c46b48>:0

at Mono.Net.Security.MobileAuthenticatedStream+<StartOperation>d__58.MoveNext () [0x001bf] in <c9226b2f33b7421e85bb391f94075e49>:0

--- End of inner exception stack trace ---

---> (Inner Exception #0) System.ObjectDisposedException: Cannot access a disposed object.

Object name: 'MobileAuthenticatedStream'.

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <1f0c1ef1ad524c38bbc5536809c46b48>:0

at Mono.Net.Security.MobileAuthenticatedStream+<StartOperation>d__58.MoveNext () [0x001bf] in <c9226b2f33b7421e85bb391f94075e49>:0 <---

UnityEngine.Debug:Log(Object)
Test:LastExceptionHandler(Exception, String) (at Assets/Test.cs:55)
Test:<Start>b__0_0(Object, UnobservedTaskExceptionEventArgs) (at Assets/Test.cs:15)
System.Threading.Tasks.TaskExceptionHolder:Finalize()

  1. Resolution Note (fix version 2020.1):

    Fix ObjectDisposedException that may occur when using HttpWebRequest.

Comments (2)

  1. ismaelmolu

    Mar 17, 2023 08:54

    In unity LTS 2021.3.8 happens as well

  2. valsidalf

    Nov 17, 2020 14:53

    Please, do you plan to fix this issue also in the latest LTS release 2019.4?

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.