Questions tagged [dispose]

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources

Filter by
Sorted by
Tagged with
1 vote
1 answer
30 views

Localization resources in another project not accessible (WPF, C#)

First of all: I am not very educated about disposing object and the ways to do it. The project: Currently I am working on a solution that includes an ASP.Net API, WPF and library project (all in .NET ...
tomo_2403's user avatar
0 votes
0 answers
40 views

Disposing of cancellationToken that is static

I have CancellationTokenSource that must be shared across multiple threads. (If ChargeRuleCreatedEvent fires twice, then previous must be canceled) My question is: Do I have to dispose ...
RicardMackevic's user avatar
1 vote
2 answers
44 views

When I use the bloc state management in Flutter, it is automatically disposed?

How can I prevent the bloc disposing? And when and where I want it to be disposed? When the state does not change, but the value that comes with that state, such as a list, when it changes, ui does ...
Shervin's user avatar
  • 11
0 votes
2 answers
76 views

Does the await automatically dispose the StreamReader resource in C#?

Does it make sense to use the using pattern in this case? Or does await automatically dispose of this resource? var payload = await new StreamReader(HttpContext.Request.Body).ReadToEndAsync();
user3418560's user avatar
0 votes
0 answers
52 views

How to dispose an unmanaged resource/object that doesn't implement IDisposable

Actually question is simple but I wanted to provide as much information as possible to help everyone to understand problem/issue. For this reason question may seem long/hard. My question is briefly: ...
livan3li's user avatar
  • 129
0 votes
0 answers
35 views

Pass empty regex replacement in Azure group claim

I am using SAML group claim for provisioning users into a group in applications upon login. These groups will have a prefix in Azure, and that prefix should be dropped when they login so that they are ...
Elijah Guastella's user avatar
0 votes
1 answer
26 views

How to properly close a PreparedStatment & ResultSet in an Iterator?

When I implement a custom Iterator<T> that needs to use a PreparedStatement and a ResultSet that both are closeable how do I correctly close them? fun select(): Sequence<Item> = object ...
t3chb0t's user avatar
  • 16.4k
0 votes
0 answers
10 views

Domain Driver Design after passing controller in another thread context lost. (Dot Net Core)

In my DDD dot net core projects all service instance created . at the end of controller method, started a thread of action method in same controller. But when the method start to get data it lost ...
Iftakhar alm's user avatar
0 votes
0 answers
18 views

dispose a ChangeNotificationProvider within a StatelessWidget

I have this nice exception A TabClickNotifier was used after being disposed.. The general answer is probably given here: Unhandled Exception: A ChangeNotifier was used after being disposed However, I ...
w461's user avatar
  • 2,189
0 votes
0 answers
33 views

how do I solve flutter unmounted state?

This widget has been unmounted, so the State no longer has a context (and should be considered defunct). Consider canceling any active work during "dispose" or using the "mounted" ...
Brent Carey's user avatar
0 votes
1 answer
78 views

Multicast onBackpressureBuffer Sink does not accept new Subs after dispose

When I unsubscribe the last Sub and sub again, I expect the Sink/Flux to work or throw an Exception. See my Testcode: void playground() { Sinks.Many<String> sink = Sinks.many().multicast(...
user17780952's user avatar
1 vote
0 answers
30 views

Multiprovider for multiple Tests within one file?

I need to write multiple tests for a widget and I m using a multiprovider for my controller. The problem is that: the controller is disposed after finishing the first test it can't be called again. My ...
Henrik's user avatar
  • 54
0 votes
1 answer
136 views

Firestore: How does StreamBuilder work and how to use it efficiently

I want to know: Suppose I have a streamBuilder in an application like Chat, so if a user is not on the screen that has the streamBuilder and a new doc is added would it automatically count as a read? ...
Uraam Asif's user avatar
0 votes
0 answers
8 views

Understanding the meaning and implication of Blending and disposal method stated in Google's WebP Container Specification

I am working with aniamted webp. I am referring google's documentation called WebP Container Specification The doc says the following things about blending and disposal methods Blending Method: ...
CrackerKSR's user avatar
  • 1,400
-1 votes
3 answers
43 views

Disposable child properties in C# [duplicate]

I have inherited a C# class. This class has two properties which are IDisposable. However, the class itself does not IDisposable. For the context of this conversation, let's pretend the class looks ...
Developer's user avatar
0 votes
0 answers
56 views

WebDriver does not dispose

I’m using the Microsoft Edge WebDriver to test inprivate browser windows but I’ve noticed 2 things: WebDriver process does not always end When running more than 1 at a time, taking screenshots often ...
Matt W's user avatar
  • 11.8k
0 votes
1 answer
27 views

Display and then close a frame in Java

Here the code: public class attrape_ball { JFrame frame = new JFrame(); JPanel attrape = new JPanel(); public attrape_ball(pokeball pk) { JLabel ramasseball = new JLabel("...
Thibaud Zobel's user avatar
0 votes
1 answer
72 views

SetPixel and GetPixel give different values C#

I have 2 different classes. I am setting and saving (with Bitmap.Save()) a bitmap from an image in a class. I am getting pixel from this Bitmap in another class. But I get very different values from ...
user avatar
1 vote
1 answer
104 views

How to handle circular Dispose() in C#

When I have a circular dependency between two IDisposable objects that rely on each other and should also propagate disposal to each other, how shall I best avoid a StackOverflowException from an ...
michi-b's user avatar
  • 205
0 votes
0 answers
52 views

Drawing to a GDI+ metafile that is based on a memory stream - can the stream be disposed afterwards?

I am using a MemoryStream to write my GDI+ drawing commands to a Metafile, and display the Metafile later in order to accelerate such trivial tasks as panning and zooming. That works fine. When I ...
oliver's user avatar
  • 2,781
1 vote
0 answers
47 views

ApplicationAdapter's dispose() method not being called when app destroyed

I'm working on a multiplayer game using libgdx. I want to handle sending some log out info to the server before the connection is closed. From what I've read Libgdx's ApplicationAdapter class' dispose(...
Michael's user avatar
  • 33
0 votes
3 answers
245 views

Dispose a disposable, instantiated within a non-async IAsyncEnumerable<T>, after enumeration

I want to expose reading and parsing data from a file asynchronously into strings, through an IAsyncEnumerable<string>, so my calling code can process the data as it comes in. The problem is ...
CodeCaster's user avatar
  • 148k
0 votes
2 answers
129 views

Should I close or dispose a SqlConnection registered as InstancePerRequest?

I'm registering a new instance of System.Data.SqlClient.SqlConnection as InstancePerRequest in Autofac, and I .Open() the connection in the registration. I use it in multiple repository services which ...
Askish's user avatar
  • 79
0 votes
0 answers
40 views

Windows Server 2012 R2: C# X509Certificate2 Reset/Dispose-Method needs up to 16minutes to finish

We are using Win Server 2012 R2 on a virtual machine, 8gb ram, 2,2ghz. Only on this server, one of my applications needs very long to shut down. I spent two days and found out that resetting/disposing ...
kraeppy's user avatar
  • 23
0 votes
2 answers
115 views

Is it a good practice to Execute API on Dispose?

I have some legacy code that execute an Http API call on Dispose, this class read some data from an API and permits the manipulation, the save of the manipulated data is executed in the Dispose method ...
Nadir's user avatar
  • 101
0 votes
0 answers
22 views

Android BroadcastReceiver receives past message

Android BroadcastReceiver receives past message when receiving data from google spread sheet. More over, those messages inclease gradually! Restart cell phone leads correct results. [Actual] Sheet A:...
Takuji Matsugaki's user avatar
1 vote
1 answer
552 views

How to close and dispose Azure ServiceBusClient and ServiceBusSender singletons asynchronously when using dependency injection, e.g., in ASP.NET?

I want to use Azure Service Bus in .NET 7 applications, such as ASP.NET Core Web API pr Worker Service, which use dependency injection. The official documentation recommends registering ...
Joerg's user avatar
  • 800
2 votes
1 answer
292 views

Flutter GoogleMap Widget creates lingering artifacts when I change screen

I've got a GoogleMap widget sandwiched amongst other Widgets on a screen. If I Navigate away, Flutter doesn't dispose of the Map before the new page loads. This is doubly annoying because I have ...
Sam's user avatar
  • 1,679
0 votes
0 answers
57 views

VB.NET Reload public variable as new control

My question is how do you programmatically reload a public variable as new control after disposing it? Basically I have a public control in my module like: Public ComboBox_Subgroup As New ComboBox ...
Eduards's user avatar
  • 68
0 votes
3 answers
121 views

Problem of initialization of values in Flutter

I'm trying to select a value in a dropdown menu and transfer that value to the dropdown menu title when it closes, but an error message appears when I try to do this, but the value does appear in the ...
Corentin's user avatar
0 votes
1 answer
57 views

flutter memory leak my widget in homescreen

this is the error cause when I return to home screen. Is there any way to solve this? I tried dispose my timer but it did not work bool containerClicked = false; int nextSpinValue = 0; int? ...
Afthal Ad's user avatar
0 votes
0 answers
78 views

Do I dispose CancellationTokenSource when I'm using it for timeout only in this use case?

This is a request-response model for websocket messages where you can technically match request id to response id and return the response. In addition to that, there is timeout in case that message is ...
nop's user avatar
  • 4,751
0 votes
0 answers
21 views

How to make a connection to the USP external device via ASP.net core Web App?

How to make a connection to the USP external device via ASP.net core Web App??? Need the code It's already been worked on but there were some problems when testing the code
mostafa soliman's user avatar
0 votes
0 answers
42 views

How to destroy a class in C#

i was trying to destroy a class when i want, but it just doesn't get destroyed. I want to destroy it even if it had references in other places and and turn those references into nulls. Like in unity ...
Taim Daboul's user avatar
2 votes
1 answer
122 views

Finalizer not being called after garbage collection

I have a test program that implements ManagedClass with both Dispose method and a Finalizer. I'm forcing garbage collection via GC.Collect(), but Finalizer is only called if an object is created in a ...
Noby's user avatar
  • 57
0 votes
0 answers
87 views

In Flutter, how can I make sure that ChangNotifier is not being used before running the state dispose?

I'm getting the following error with ChangeNotifier.dispose. A ShakeWidgetState was used after being disposed. Once you have called dispose() on a ShakeWidgetState, it can no longer be used. When the ...
jdevp2's user avatar
  • 371
1 vote
1 answer
176 views

Amazon cannot access closed stream

I am trying to use amazon s3 libs but somehow can't pass stream to upload data to s3. At the beginning I was using using statements but then rewrote it to try catch dispose and still I can't even ...
kosnkov's user avatar
  • 5,629
1 vote
0 answers
51 views

Flutter - A TextEditingController was used after being disposed - Provider

I have a List of custom widgets that contain a TextFormField and use a TextEditingController which I initialize in the initState() function of the custom widget. I have wrapped the custom Widget in a ...
Sebb's user avatar
  • 121
2 votes
0 answers
31 views

Is it necessary to dispose a task when ran to completion or faulted? [duplicate]

I am accepting TCP clients using the below code: TcpClient client = tcpListener.AcceptTcpClient(); Task.Factory.StartNew(() => Read_it(client, tcpPort)).ContinueWith(x => { if (x....
Ahmet's user avatar
  • 33
0 votes
1 answer
69 views

How do you open an already disposed form in VB?

When I close Form2 it won’t open up again after. I am using a button click to open up another form. Right now I just have: Dim Form2 As New Form2 Private Sub btn_Click(ByVal sender As System.Object, ...
Bailey Nygard's user avatar
0 votes
2 answers
607 views

HttpClient and HttpclientHandler Dispose or not dispose, that is the question

I am looking to optimize my code… I have number of API with early same structure for client and handler. But I have some questions about disposing. I have read the using statement automatically ...
Frenchy's user avatar
  • 16.4k
1 vote
1 answer
270 views

Why we need to call `dispose` method while member is property of the disposed class?

I am looking at the flutter example below; https://docs.flutter.dev/cookbook/forms/text-field-changes#interactive-example it has code like; import 'package:flutter/material.dart'; void main() => ...
Teoman shipahi's user avatar
0 votes
0 answers
426 views

Flutter: does scrollController.position.isScrollingNotifier need to remove listener on dispose? Why's it crashing my app?

I am able to demonstrate my issue with this simple code below. Basically, I am adding listener to both the ScrollController and scrollController.position.isScrollingNotifier in the init. The ...
sudoExclaimationExclaimation's user avatar
0 votes
0 answers
66 views

Assuring that Objects are Disposed before Finalization in C#

I have trouble implementing a C# wrapper for rcl which has a struct named rcl_context_s encapsulating non-global state for some rcl_node_s structs. There are functions for finalizing these structs ...
Deric's user avatar
  • 180
0 votes
2 answers
32 views

The predefined dispose function is not available in android studio

i am creating a connection between my flutter application and firebase but when the time came to use the dispose function it is not defined i've added the package as a library to the flutter and dart ...
Omar's user avatar
  • 3
1 vote
1 answer
100 views

System.ObjectDisposedException

----- Cannot access a disposed context instance. A common cause of this error is disposing a context instance that was resolved from dependency injection and then later trying to use the same context ...
Marwen Saad's user avatar
2 votes
2 answers
32 views

Flutter disposing large no of TextEdititingController

I have no of TextEditingController a, TextEditingController b.......z 1) How to short cut way dispose all TextEditingController @override void dispose() { // _nameCtrl.dispose(); a.dispose();...
Yeung Ka Wing's user avatar
2 votes
3 answers
526 views

C# Windows form closing automatically

I have a windows application where my first windows form is Login. After successful login, it has to open "Home" form. I see "Home" form while debugging, but once the code enters ...
Santosh's user avatar
  • 2,355
0 votes
1 answer
112 views

How is .NET breaking in this catch block after an await using?

We are using a .NET 7 generated service (from a WSDL) that inherits System.ServiceModel.ClientBase which implements IAsyncDisposable. The ClientBase client is generated by VS2022. This service should ...
Keith's user avatar
  • 150k
0 votes
0 answers
67 views

Examples of unmanaged resources when to implement Dispose pattern in C#

.NET documentation states when the dispose pattern is supposed to be used. It is when we interact with: file handles pipe handles registry handles wait handles pointers to blocks of unmanaged memory ...
Patrik Mihalčin's user avatar

1
2 3 4 5
40