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 608257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:26:36+00:00 2026-05-13T17:26:36+00:00

Given the following code Public Shared Sub DoAsyncAction() Using asmxProxy As New MyAsmxServiceProxy() AddHandler

  • 0

Given the following code

    Public Shared Sub DoAsyncAction()
        Using asmxProxy As New MyAsmxServiceProxy()
            AddHandler asmxProxy.WebFunctionCompleted, AddressOf WebFunctionAsync_Completed

            // Make the Async ASMX Webservice Call
            asmxProxy.WebFunctionAsync()

            // RemoveHandler asmxProxy.WebFunctionCompleted, AddressOf WebFunctionAsync_Completed
        End Using
    End Sub

    Private Shared Sub WebFunctionAsync_Completed(ByVal sender As Object, ByVal e As MyAsmxServiceProxy.WebFunctionCompletedEventArgs)
        // Do Stuff
    End Sub

I was wondering how the event handler is maintained here. So, let say the WebFunctionAsync() internally takes ~30 seconds to complete. When that time is up, it will fire the WebFunctionCompleted event, but will my handler (WebFunctionAsync_Completed) still get hit even thought the webClient has been disposed and gone out of scope?

If the question to the last answer is Yes, what if I commented in the RemoveHandler line. Would it then?

I guess what I’m trying to find out is, at the time the async function is called, are the registered event handlers “cached” (so to speak) along with the call, so that no matter what happens to the ASMX proxy object or even if the handlers are removed, the registered event handlers at the time the call will still be hit when the events fire?

Maybe this is really obvious, but for some reason I can’t seem to logically come to a conclusion on this, and I didn’t find any answers in the few places I looked on MSDN.

  • 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-13T17:26:37+00:00Added an answer on May 13, 2026 at 5:26 pm

    I should have done this from the beginning, but I put together a little test case and here were my results.

    … but will my handler
    (WebFunctionAsync_Completed) still get
    hit even thought the webClient has
    been disposed and gone out of scope?

    With the code as presented above, Yes the handler will be called, but as @JohnSaunders pointed out, the sender parameter of the event handler will be the disposed instance of the MyAsmxServiceProxy object. Probably not a big deal if you don’t plan on using it in the handler I suppose, but still worth noting.

    If the question to the last answer is
    Yes, what if I commented in the
    RemoveHandler line. Would it then?

    With the RemoveHandler line commented in, a race condition occurs. If the RemoveHandler line is called before the Completed event is fired, then the handler is never invoked. So the answer to the second question is No.

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

Sidebar

Ask A Question

Stats

  • Questions 315k
  • Answers 316k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try using android:stretchColumns="0" (when you define the TableLayout) or what… May 13, 2026 at 11:23 pm
  • Editorial Team
    Editorial Team added an answer Answer! public static void ExtractFileFromResources(String filename, String location) { StreamResourceInfo… May 13, 2026 at 11:23 pm
  • Editorial Team
    Editorial Team added an answer Okay I fixed this by opening the three20.xcodeproj and unchecking… May 13, 2026 at 11:23 pm

Related Questions

Problem: I would like to share code between multiple assemblies. This shared code will
I can't figure out what is up with this. I have a Scene class
Let's say I have the following class structure: class Car; class FooCar : public
Consider the following example code: class Foo { }; class Bar : public Foo
I can't figure out what I'm missing in the following code. I've got a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.