Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 763513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T16:34:24+00:00 2026-05-14T16:34:24+00:00

I am working to a VB.NET windows forms projet in .NET 1.1. And I

  • 0

I am working to a VB.NET windows forms projet in .NET 1.1. And I have this type of architecture, very simplified.

Public MustInherit Class BaseTestLogic

  Private _TimerPoll As Timer

  Public Sub New(ByVal sym As SymbolFileMng, ByVal cfg As LampTestConfig, ByVal daas As DaasManager, ByVal mcf As Elux.Wg.Lpd.MCFs.VMCF)

    AddHandler _TimerPoll.Tick, AddressOf TimerPoll_Tick

  End Sub

End Class

Public Class SpecificTestLogic
  Inherits BaseTestLogic      

End Class

Depending of the type of test I am doing I create an instance of a specific test derived from BaseTestLogic. But I found that after hundreds of object creations I can have StackOverflow exception.

I checked my code and saw that I forgot to remove the handler to Timer Tick. The question is, where and when is it correct to remove hadler?

Do I need to implement the IDisposable interface in the base class and RemoveHandler in Dispose?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T16:34:25+00:00Added an answer on May 14, 2026 at 4:34 pm

    You may go along with removing the handler when the Dispose is called, but a purist would say that “you shouldn’t abuse IDisposable for purposes other than disposing unmanaged resources”.

    Another option is to remove the handler at the Finalize method.

    You can also feel comfortable about removing the handler at several different places, if that makes any sense in your design. Removing an already removed handler will not cause any issue – unless the event is a Custom Event and its AddHandler/RemoveHandler implementations don’t match the behavior of non-custom events (which is simply to use [Delegate].CombineDelegate/[Delegate].Remove). Just don’t tell your purist friends about it; they won’t comply.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a visual studio 2005 vb.net windows forms project that's been around
I'm working on a Windows Forms (.NET 3.5) application that has a built-in exception
I've been working in windows forms applications and ASP.Net applications for the past 10
I am working on a Windows Forms application in C#/.Net. I want to use
I am working on a C# .NET application with System.Windows.Forms.WebBrowser. IE is not responding
I have written a Windows Forms application in C#, .NET framework 2.0, that uses
My team is currently working on windows forms project using VB.NET. We are curently
I'm working on a windows forms application (.NET 4.0). My form contains a 'Fast
I'm working on a Windows Forms application in .NET 4.0. As I am binding
I'm developing a windows forms application using VB.NET. I'm currently working on DataReport (by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.