Answered by:
Mobile reports - "Cannot access a disposed object" exception

Question
-
Mobile reports are intermittently throwing the exception, "Cannot access a disposed object.". The full text of the exception is below. The exception may occur for one or more data sets in the mobile report. If the user efreshes the mobile report in the browser, it's likely that the exceptions will not recur.
Full exception text and stack trace:
Microsoft.ReportingServices.Portal.WebHost!reportserverwebapp!1d!01/03/2017-10:34:51:: e ERROR: [diwc4uo1]: 199.189.197.10: POST /api/v1.0/CatalogItems%282b4d5f78-d254-4f3e-8881-becad01ed099%29/Model.DataSet/Model.GetData - 0:00:44.1088394
Exception: System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.HttpListenerResponse'.
at System.Net.HttpListenerResponse.CheckDisposed()
at System.Net.HttpListenerResponse.set_ContentLength64(Int64 value)
at Microsoft.Owin.Host.HttpListener.RequestProcessing.HeadersDictionaryBase.Set(String key, String[] value)
at System.Web.Http.Owin.HttpMessageHandlerAdapter.SendResponseMessageAsync(HttpRequestMessage request, HttpResponseMessage response, IOwinResponse owinResponse, CancellationToken cancellationToken)
at System.Web.Http.Owin.HttpMessageHandlerAdapter.<InvokeCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Owin.HttpMessageHandlerAdapter.<InvokeCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.ReportingServices.Portal.WebHost.Owin.LocalRequestMiddleware.<Invoke>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.ReportingServices.Portal.WebHost.Owin.RequestThrottlingMiddleware.<InvokeNext>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.ReportingServices.Portal.WebHost.Owin.RequestThrottlingMiddleware.<InvokeInternal>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.ReportingServices.Portal.WebHost.Owin.RequestLoggingMiddleware.<Invoke>d__0.MoveNext()
Gregory Block, PhD, MBA
Tuesday, January 3, 2017 3:45 PM
Answers
-
Hi Gregory,
Thank you for such a detailed analysis and description. Honestly the issue is weird, because the Mobile reports are intermittently throwing the exception.
So, I would suggest you to submit the feedback to Microsoft, Microsoft will response to you.
Thanks for your understanding and support.
If you still have any questions, please feel free to ask.
Best Regards,
Pirlo Zhang
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.- Proposed as answer by Pirlo Zhang Tuesday, January 24, 2017 7:26 AM
- Marked as answer by Gregory Block, PhD Tuesday, January 24, 2017 1:35 PM
Tuesday, January 10, 2017 9:26 AM
All replies
-
Hi Gregory,
According to your description, does the issue occurred when user open the mobile report via browser? Alternatively the issue occurred when user is running the mobile report? Do the all of the mobile reports have the issue or just some of them have the issue? Did you try to use different browser to have a test and check if the issue persist?
Based on the error message, I'm afraid it's difficult to find out the cause of the problem. Would you please share more detailed information with us for analysis if possible?
Thanks,
Pirlo Zhang
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.Wednesday, January 4, 2017 9:22 AM -
Pirlo, thanks for looking into this matter. I agree that it is difficult to find the cause of the problem!
The problem occurs when a user views the mobile report in a browser window (they are viewing, not editing the mobile report). The browser usage (Firefox, MS Edge, or Google Chrome) does not make a difference - the error is thrown irrespective of browser. The error is intermittent, and if the user refreshes the browser page, the error may not appear after the refresh.
The user will see the "misconfigured" error message in the browser window, and when i view the reporting server logs, I can identify the exception is logged at the the same time as the user reports seeing the error message.
To summarize, the error occurs regularly but intermittently, across browsers, for different users who are viewing mobile reports. The error does not appear in paginated reports, even though both paginated and mobile reports share the same datasets. Each time the error occurs, it is manifested as one or more "misconfigured" error messages in the user's browser window, and an exception stack trace in the reporting server log.
Gregory Block, PhD, MBA
Wednesday, January 4, 2017 2:50 PM -
Hi Gregory,
Thank you for providing such detailed information.
It seems there's some confusion in the ReportServer database. So, it is recommended that please try to change the database for SSRS by SQL Server 2016 Reporting Services Configuration Manager and do a test and check if the issue persist. Also, please back up your original database before you change it.
Thanks,
Pirlo Zhang
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.Thursday, January 5, 2017 7:41 AM -
Pirlo, thanks for your reply, but your explanation and remedy don't seem to have anything to do with the exception I reported. The exception "System.ObjectDisposedException: Cannot access a disposed object." is a .NET exception that is unrelated to the database that SSRS is using. Besides, what would I change the SSRS database to? I'd have to initialize another ReportServer database and it would no longer have any of my settings.
Again, I appreciate that you took the time to reply to my post.
Gregory Block, PhD, MBA
Thursday, January 5, 2017 1:22 PM -
Hi Gregory,
Yes, the exception "System.ObjectDisposedException: Cannot access a disposed object." is a .NET exception, so do you use the Report Server Web Service API?
What I mean is that you can try to check if the issue caused by the configuration of ReportServer Database. This is not a good idea, as you mentioned, this will initialize another ReportServer database. So, if you would like to try it, please make a backup before you change it . Or you can share more detailed information if possible.
Thanks,
Pirlo Zhang
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.Monday, January 9, 2017 4:26 PM -
Hello Pirlo. Thanks again for your response.
The ObjectDisposedException is generated by SSRS intermittently when a user browses the mobile reports; I am not using the Report Server Web Service API.
This is not a configuration issue, because it occurs intermittently; configuration issues would probably occur every time, because a configuration is static. There is no need for me to initialize a new SSRS database.
What is more likely to be the problem is that the mobile report is trying to access a dataset after the dataset cache has expired; therefore the expired dataset object has already been disposed. In other words, it's more likely to be a programming error in the mobile report rendering. However, the stack trace does not sufficiently describe the context when the error occurs.
Should I report this as a mobile report defect?
Gregory Block, PhD, MBA
Monday, January 9, 2017 4:52 PM -
Hi Gregory,
Thank you for such a detailed analysis and description. Honestly the issue is weird, because the Mobile reports are intermittently throwing the exception.
So, I would suggest you to submit the feedback to Microsoft, Microsoft will response to you.
Thanks for your understanding and support.
If you still have any questions, please feel free to ask.
Best Regards,
Pirlo Zhang
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.- Proposed as answer by Pirlo Zhang Tuesday, January 24, 2017 7:26 AM
- Marked as answer by Gregory Block, PhD Tuesday, January 24, 2017 1:35 PM
Tuesday, January 10, 2017 9:26 AM -
Hello Pirlo Zhang,
Is this issue resolved? If yes, can you please share the URL?
Monday, June 18, 2018 1:33 PM