Windows error 0x80131622, -2146232798

Detailed Error Information

COR_E_OBJECTDISPOSED[1]

Message"The object has already been disposed."
Comment The object has already been disposed.

HRESULT analysis[2]

FlagsSeverityFailure
Reserved (R)false
OriginMicrosoft
NTSTATUSfalse
Reserved (X)false
FacilityCode19 (0x013)
NameFACILITY_URT[2][3]
DescriptionThe source of the error code is .NET CLR.[2][3]
Error Code5666 (0x1622)

Questions

10votes
1answer

Cannot access a disposed object Asp.net Identity Core

I am getting this error System.ObjectDisposedException HResult=0x80131622 Message=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 your application. This may occur if you are calling Dispose() [...] read more
c#
asp.net-identity
entity-framework-core
asp.net-core-2.0
10votes
6answers

Windows phone 8.1 emulator not loading OS

I am trying to launch the emulator (Emulator 8.1 WVGA 4 inch 512 MB, or any other as a matter of fact) but it fails to launch. It goes to the "Loading OS" screen then throws an error box with the text "DEP6100". On VS, it says at the bottom [...] read more
windows-phone-8
visual-studio-2013
windows-phone-8-emulator
4votes
1answer

Application Insights add username to telemetry

I'm trying to log the usernames for users in application insights when they are doing requests. I've been trying to do it this way as: public class AppInsightsInitializer : ClientIpHeaderTelemetryInitializer { private readonly IHttpContextAccessor _httpContextAccessor; public AppInsightsInitializer(IHttpContextAccessor httpContextAccessor) : base(httpContextAccessor) { _httpContextAccessor = httpContextAccessor; } protected override void OnInitializeTelemetry(HttpContext platformContext, [...] read more
c#
asp.net
azure-application-insights
3votes
1answer

Server Side Blazor + Kestrel + Windows Auth = Crash

I am trying to setup windows Auth using kesterel on blazor server side.I have the progam setup like this: I am using version 0.6.0 of Blazor server side and latest release of VS 2017. Using the out of the box blazor temnplate. You can see that I enabled "windows Auth" [...] read more
windows-authentication
kestrel-http-server
blazor
2votes
2answers

ObjectDisposedException on a ASP.NET Core 2.0 MVC custom database initializer class

I'm getting the following exception in my custom database initializer class: > System.ObjectDisposedException occurred HResult=0x80131622 > Message=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 [...] read more
c#
asp.net-core-2.0
2votes
1answer

Issue starting windows phone emulator

Windows OS 10 Windows Phone emulator is unable to verify that the machine is running. I Also experience this issue when running android simulators through Visual Studio Error: http://puu.sh/rYSHI/1f87937cb1.png [https://i.stack.imgur.com/lLVS8.png] > Error for running android: Could not launch "VS Emulator 7" Kitkat (4.4) XHDPI > Tablet device. Exit code 10. [...] read more
windows
windows-phone-8
windows-10-mobile
1vote
1answer

System.ObjectDisposedException - Using SQL Connection within Using Block

> System.ObjectDisposedException HResult=0x80131622 Message=Cannot access a > disposed object. Object name: 'SQLiteConnection'. > Source=System.Data.SQLite I've written a simple repository that uses Dapper and DapperExtensions When trying to retrieve some results, I get this error when using a Usingblock after the method returns to the view model. When replacing the Using [...] read more
c#
exception
dapper
dbcontext
idisposable
1vote
2answers

ObjectDisposedException thrown when trying to save files to a DbContext

I am uploading a text file and writing each split line to a database. The file has over a million lines. The upload and saving to the database works but breaks after the save on the await _context.SaveChangesAsync(); line with the following error > System.ObjectDisposedException HResult=0x80131622 Message=Cannot access a > [...] read more
c#
asp.net-core
entity-framework-core
1vote
1answer

In SerialPort, Access Denied when calling Close, but not Dispose

UPDATE 1 I found out that if I reverse the order of my close/dispose then I get the error from dispose instead of close... so probably disposable protection means the method is only invoked once. I've been able to replicate the error on my device by creating a short to [...] read more
c#
serial-port
dispose
unauthorizedaccessexcepti
1vote
1answer

How to Seed Roles in .NET Core 2.0?

At the moment I am trying to get Roles configured using the RoleManager<Identity>, built into .NET Core 2.0, mvc-framework. However I am getting the following error: System.ObjectDisposedException HResult=0x80131622 Message=Cannot access a disposed object. A common cause of this error is disposing a context that was resolved from dependency injection and [...] read more
c#
asp.net-core
.net-core
asp.net-core-mvc
.net-core-2.0
1vote
1answer

When trying to upload file, FileBufferingReadStream.ThrowIfDisposed() error occurr

I receive a image file with Microsoft.AspNetCore.Http.IFormFile type in Controller. And I upload this file on Azure Blob. Before that I take a process like following Controller [HttpPost] public async void ActionMethod(IFormFile img) { // some process using(MemoryStream stream = new MemoryStream()) { // (1) img.CopyTo(stream); // (2) stream.Seek(0, SeekOrigin.Begin); [...] read more
c#
asp.net-core
azure-storage
azure-storage-blobs
0votes
1answer

cefsharp winform silent print to pdf if js callback window.print()

I've a problem with a popup and print it to pdf silently. When I push print button (on the site), it's open a popup, generate a barcode and then popup prints. The popup contain two js functions window.print() and then window.close(). I need to print this popup silently to pdf, [...] read more
javascript
c#
printing
cefsharp
0votes
0answers

Applicationinsights customized telemetry leads to ObjectDisposedException

I'm trying to get the UserName of connected users for our application insights services but adding the custom telemetry to log UserName gives me a System.ObjectDisposedException occurred in mscorlib.dll but was not handled in user code error. Exception: Exception thrown: 'System.ObjectDisposedException' in mscorlib.dll An exception of type 'System.ObjectDisposedException' occurred in [...] read more
c#
asp.net
.net
azure-application-insights
0votes
0answers

How to inject the dbContext into iLogger

I trying to inject the ApplicationDbcontext into iLogger. When I use _context variable inside the CustomLoggerProvider or CustomLoggerExtension it'is work. While when the software CreateLogger create a instance of CustomLogger, I have a problem with ApplicationDbContext, when I use the _context variable to access the database the application crashes and [...] read more
c#
asp.net
asp.net-mvc
web-services
dependency-injection
0votes
0answers

Cannot access a disposed object. A common cause of this error is disposing a context that was resolved from dependency injection

My DbContext is being disposed at the first call to it from my application logic. I have a project that is structured like this. RootFolder ---DbContextProject //This is a .Net class library project ---ModelsProject //This is a .Net class library project ---InterfacesProject //This is a .Net class library project ---ApplicationLogicProject [...] read more
c#
asp.net-core
0votes
1answer

How to fix System.ObjectDisposedException while creating user

I need to create a user telegram in IDENTITY. But when using the method _userManager.CreateAsync(appUser), I get an error. Before that, I used IDENTITY only in the controller, from the data coming in the form. Now, I need to create a user from the data that comes from telegrams. My [...] read more
c#
asp.net-core
asp.net-identity
0votes
1answer

Correctly using of dependency injected DbContext to query Database

I have set up my own context using (as I believe is correct): public void ConfigureServices(IServiceCollection services) { services.AddDbContextPool<JobTrackingContext>(options => options.UseNpgsql(connection)); services.AddScoped<IJobRepository, JobRepository>(); } Then I define my JobTrackingContext as follows: public JobTrackingContext(DbContextOptions<JobTrackingContext> options) : base(options) { public DbSet<Job> Jobs { get; set; } } Now I can define a [...] read more
asp.net
entity-framework
dependency-injection
.net-core
0votes
0answers

DataGridView.BeginEdit() fails because DataGridViewTextBoxEditingControl is disposed

In the code below, I simply try to do a BeginEdit(False) in a DataGridView. Occasionally, this fails with: System.ObjectDisposedException HResult=0x80131622 Message=Cannot access a disposed object. Object name: 'DataGridViewTextBoxEditingControl'. Source=System.Windows.Forms StackTrace: at System.Windows.Forms.Control.CreateHandle() at System.Windows.Forms.TextBoxBase.CreateHandle() at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl() (...) I've ensured that the cell is the current cell, that [...] read more
vb.net
datagridview
objectdisposedexception
0votes
1answer

How to inject DbContext in an Action Filter

I have an action filter which logs the request in a database. I use the usual construction injector method. public ServerLogFilterAttribute(OrderEntryContext context) { this.context = context; } public override void OnActionExecuting(ActionExecutingContext context) { var descriptor = context.ActionDescriptor; if (descriptor != null && descriptor.RouteValues.Count > 0) { var actionName = descriptor.RouteValues["action"]; [...] read more
c#
asp.net-core
entity-framework-core
0votes
1answer

WCF ServiceHost Callback Unstable

Problem The most reproducible scenario is starting the desktop application from a link on the tray application and then requesting the desktop application via a callback to do something. That virtually always throws a timeout error as other subsequent errors. WCF Environment: Server: A System Tray applet Client: WinForms desktop [...] read more
c#
windows
wcf
timeout
pipe
0votes
0answers

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 been closed Source=mscorlib StackTrace: > at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success) > at System.StubHelpers.StubHelpers.SafeHandleAddRef(SafeHandle pHandle, > Boolean& success) at > [...] read more
sqlite
entity-framework-core
objectdisposedexception
-1votes
1answer

DbContext in ASP.NET Core throws System.ObjectDisposedException

I am saving a Todo model to database using EF Core in ASP.NET Core app. But when I try to print the success message using Console.Writeline it throws System.ObjectDisposedException Here's full application github code link Here's ToDo model: public class Todo { public int Id { get; set; } [Required] [...] read more
c#
asp.net-core
entity-framework-core
objectdisposedexception

Comments

Leave a comment

(plain text only)

Sources

  1. https://github.com/dotnet/coreclr/blob/v1.1.0/src/inc/corerror.xml
  2. https://msdn.microsoft.com/en-us/library/cc231198.aspx
  3. winerror.h from Windows SDK 10.0.14393.0

User contributions licensed under CC BY-SA 3.0