Questions tagged [objectdisposedexception]

The exception that is thrown when an operation is performed on a disposed object.

190 questions
0
votes
2 answers

Unit testing for IDomainService with ASP.NET Boilerplate

I am unit testing ABP, but I got error below: Cannot access a disposed object. A common cause of this error is disposing a context that was resolved from dependency injection and then later trying to use the same context instance elsewhere in…
Edward
  • 28,296
  • 11
  • 76
  • 121
0
votes
2 answers

IIS7 integrated mode closing token between requests

We are migrating to IIS7 integrated mode and have come across an issue. We authenticate using WindowsAuthentication but then store a reference to the WindowsPrincipal so that on future requests we can authorize as needed against AD. In IIS 7…
0
votes
1 answer

Azure Functions: Servicebustrigger -> BrokeredMessage been disposed

I been writting alot of Webjobs with similar functionallity where similar code works just fine. But with Azure Functions instead I get error sometimes. [FunctionName("Alert")] public static async void Alert([ServiceBusTrigger(Topic.Alert,…
0
votes
1 answer

C# Registry ObjectDisposedException Cases

I'm writing an application that accesses the Windows registry in C#. My question on a high level is: Are there any circumstances that would cause an ObjectDisposedException be thrown when using Registry.LocalMachine.OpenSubKey(key)? This code would…
Ibrennan208
  • 1,345
  • 3
  • 14
  • 31
0
votes
2 answers

C# Cannot access a disposed object when adding rows asynchronously to a winform datagridview

I am loading docs in a datagridview from a parallel thread using the code below: inside a block Task.Run(() => {}); When I close the form I get ObjectDisposedException Cannot access a disposed object. Looks like the if (IsDisposed || Disposing)…
losange
  • 335
  • 3
  • 14
0
votes
1 answer

ObjectDisposeException when trying to send through a reopened socket

I'm using Socket (Socket A = new Socket...) to send/receive. when something bed happens (disconnection), I'm trying to close/dispose old object, and then instancing a new socket (A = new Socket...) (same host/port) The connect() phase checks out…
Squigly
  • 1
  • 2
0
votes
0 answers

ObjectDisposedException: Safe handle has been closed when USB unplugged

I have a device (USB->serial) and an application software (.NET 3.5) connected to the device COM port. There is a function which is able to reboot the device (done by sending a serial command to the device). The problem is, ObjectDisposedException…
0
votes
2 answers

C# open forms with button

I want to ask this. I have a form this form can control 4 more forms. When i click on the "open form 1" button it is okay but when i clicked "open form 2 " i getting some problem. my codes like public Form1() { InitializeComponent(); …
furkan as
  • 23
  • 4
0
votes
2 answers

SlidingMenuSharp System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Android.Widget.Scroller'

We have a Xamarin.Android 7 app. We are getting the following exception which causes the app to crash. It says something about Android.Widget.Scroller, but we are not using this component explicitly in our app anywhere. We are using ScrollView and…
0
votes
1 answer

Can not access disposed object in CellEditFinished event popup messages of ObjectListView

When I click on the 'Open Modal Window' button in [Main form], it shows the [subform] that is built with a data list by using the ObjectListView component. When I click on the "Age" column to edit it and changed the value in the cell to be a non…
Kevin.Yang
  • 33
  • 6
0
votes
1 answer

The operation cannot be completed because the DbContext has been disposed. Affect running program

The operation cannot be completed because the DbContext has been disposed. I was wondering if someone help me with this issue. Here is my code: public partial class CustomerResearchForm : MetroFramework.Forms.MetroForm { FactorEntities…
Ali Eshghi
  • 1,131
  • 1
  • 13
  • 30
0
votes
0 answers

Entity framework Core ObjectDisposeException: "Safe handle has been closed"

Setup Entity framework core 1.1 WPF application .NET 4.5.2 The Problem: I am sometimes encountering this exception while running a query on a sqlite database. System.ObjectDisposedException occurred HResult=0x80131622 Message=Safe handle has…
ajr
  • 874
  • 2
  • 13
  • 29
0
votes
1 answer

ObjectDisposedException but why and what is disposed?

So as the title says I don't know why there is this "ObejectDisposedException". It is occuring when the download has finished during the last Call of "OnDownloadUpdated(..)". The line "this.Invoke(..)" throws the exception. ChromiumWebBrowser…
IchBestäube
  • 61
  • 3
  • 11
0
votes
1 answer

Why LINQ 2 SQL when I Dispose the context tries to get child relationships?

I use LINQ 2 SQL in one of my projects and i have numerous relationships Customer -> Documents1, Documents2, Documents3, Address, Invoices etc.... When using the LoadWith(p => p.Documents1)...etc I have performance issues, imagine 2000 customers…
0
votes
1 answer

Advice on debugging this exception

I am getting this exception when my application closes: This is the stack trace at that moment: This is the thread list at that moment: I am finding it difficult to determine exactly what is happening here. The stack suggests that the database…
DonBoitnott
  • 10,787
  • 6
  • 49
  • 68